Merge remote-tracking branch 'origin/master' into staging
Conflicts: pkgs/development/libraries/libav/default.nix pkgs/shells/bash/bash-4.2-patches.nix pkgs/stdenv/generic/default.nix
This commit is contained in:
@@ -234,6 +234,15 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
enableCryptodisk = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Enable support for encrypted partitions. Grub should automatically
|
||||
unlock the correct encrypted partition and look for filesystems.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
@@ -261,6 +270,7 @@ in
|
||||
throw "You must set the option ‘boot.loader.grub.device’ to make the system bootable."
|
||||
else
|
||||
"PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX ])} " +
|
||||
(if cfg.enableCryptodisk then "GRUB_ENABLE_CRYPTODISK=y " else "") +
|
||||
"${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
|
||||
|
||||
system.build.grub = grub;
|
||||
|
||||
@@ -199,7 +199,10 @@ sub GrubFs {
|
||||
return Grub->new(path => $path, search => $search);
|
||||
}
|
||||
my $grubBoot = GrubFs("/boot");
|
||||
my $grubStore = GrubFs("/nix/store");
|
||||
my $grubStore;
|
||||
if ($copyKernels == 0) {
|
||||
$grubStore = GrubFs("/nix/store");
|
||||
}
|
||||
|
||||
# Generate the header.
|
||||
my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";
|
||||
|
||||
@@ -168,9 +168,24 @@ if test -e /sys/power/tuxonice/resume; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "@resumeDevice@" -a -e /sys/power/resume -a -e /sys/power/disk; then
|
||||
echo "@resumeDevice@" > /sys/power/resume 2> /dev/null || echo "failed to resume..."
|
||||
echo shutdown > /sys/power/disk
|
||||
if test -e /sys/power/resume -a -e /sys/power/disk; then
|
||||
if test -n "@resumeDevice@"; then
|
||||
resumeDev="@resumeDevice@"
|
||||
else
|
||||
for sd in @resumeDevices@; do
|
||||
# Try to detect resume device. According to Ubuntu bug:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/923326/comments/1
|
||||
# When there are multiple swap devices, we can't know where will hibernate
|
||||
# image reside. We can check all of them for swsuspend blkid.
|
||||
if [ "$(udevadm info -q property "$sd" | sed -n 's/^ID_FS_TYPE=//p')" = "swsuspend" ]; then
|
||||
resumeDev="$sd"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if test -n "$resumeDev"; then
|
||||
echo "$resumeDev" > /sys/power/resume 2> /dev/null || echo "failed to resume..."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -181,6 +181,9 @@ let
|
||||
inherit (config.boot.initrd) checkJournalingFS
|
||||
preLVMCommands postDeviceCommands postMountCommands kernelModules;
|
||||
|
||||
resumeDevices = map (sd: if sd ? device then sd.device else "/dev/disk/by-label/${sd.label}")
|
||||
(filter (sd: sd ? label || hasPrefix "/dev/" sd.device) config.swapDevices);
|
||||
|
||||
fsInfo =
|
||||
let f = fs: [ fs.mountPoint (if fs.device != null then fs.device else "/dev/disk/by-label/${fs.label}") fs.fsType fs.options ];
|
||||
in pkgs.writeText "initrd-fsinfo" (concatStringsSep "\n" (concatMap f fileSystems));
|
||||
@@ -220,13 +223,14 @@ in
|
||||
options = {
|
||||
|
||||
boot.resumeDevice = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "8:2";
|
||||
type = types.str;
|
||||
default = "";
|
||||
example = "/dev/sda3";
|
||||
description = ''
|
||||
Device for manual resume attempt during boot, specified using
|
||||
the device's major and minor number as
|
||||
<literal><replaceable>major</replaceable>:<replaceable>minor</replaceable></literal>.
|
||||
Device for manual resume attempt during boot. This should be used primarily
|
||||
if you want to resume from file. Specify here the device where the file
|
||||
resides. You should also use <varname>boot.kernelParams</varname> to specify
|
||||
<literal><replaceable>resume_offset</replaceable></literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ let
|
||||
|
||||
checkService = v:
|
||||
let assertValueOneOf = name: values: attr:
|
||||
let val = getAttr name attr;
|
||||
in optional ( hasAttr name attr && !elem val values) "Systemd service field `${name}' cannot have value `${val}'.";
|
||||
let val = attr.${name};
|
||||
in optional (attr ? ${name} && !elem val values) "Systemd service field `${name}' cannot have value `${val}'.";
|
||||
checkType = assertValueOneOf "Type" ["simple" "forking" "oneshot" "dbus" "notify" "idle"];
|
||||
checkRestart = assertValueOneOf "Restart" ["no" "on-success" "on-failure" "on-abort" "always"];
|
||||
errors = concatMap (c: c v) [checkType checkRestart];
|
||||
|
||||
@@ -322,7 +322,7 @@ let
|
||||
[Service]
|
||||
${let env = cfg.globalEnvironment // def.environment;
|
||||
in concatMapStrings (n:
|
||||
let s = "Environment=\"${n}=${getAttr n env}\"\n";
|
||||
let s = "Environment=\"${n}=${env.${n}}\"\n";
|
||||
in if stringLength s >= 2048 then throw "The value of the environment variable ‘${n}’ in systemd service ‘${name}.service’ is too long." else s) (attrNames env)}
|
||||
${if def.reloadIfChanged then ''
|
||||
X-ReloadIfChanged=true
|
||||
|
||||
Reference in New Issue
Block a user