Merge remote-tracking branch 'origin/master' into systemd-219
This commit is contained in:
@@ -135,7 +135,7 @@ ln -s @modulesClosure@/lib/modules /lib/modules
|
||||
echo @extraUtils@/bin/modprobe > /proc/sys/kernel/modprobe
|
||||
for i in @kernelModules@; do
|
||||
echo "loading module $(basename $i)..."
|
||||
modprobe $i || true
|
||||
modprobe $i
|
||||
done
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ ln -sfn @udevRules@ /etc/udev/rules.d
|
||||
mkdir -p /dev/.mdadm
|
||||
systemd-udevd --daemon
|
||||
udevadm trigger --action=add
|
||||
udevadm settle || true
|
||||
udevadm settle
|
||||
|
||||
|
||||
# Load boot-time keymap before any LVM/LUKS initialization
|
||||
@@ -290,10 +290,23 @@ mountFS() {
|
||||
if [ -z "$fsType" ]; then fsType=auto; fi
|
||||
fi
|
||||
|
||||
echo "$device /mnt-root$mountPoint $fsType $options" >> /etc/fstab
|
||||
# Filter out x- options, which busybox doesn't do yet.
|
||||
local optionsFiltered="$(IFS=,; for i in $options; do if [ "${i:0:2}" != "x-" ]; then echo -n $i,; fi; done)"
|
||||
|
||||
echo "$device /mnt-root$mountPoint $fsType $optionsFiltered" >> /etc/fstab
|
||||
|
||||
checkFS "$device" "$fsType"
|
||||
|
||||
# Optionally resize the filesystem.
|
||||
case $options in
|
||||
*x-nixos.autoresize*)
|
||||
if [ "$fsType" = ext2 -o "$fsType" = ext3 -o "$fsType" = ext4 ]; then
|
||||
echo "resizing $device..."
|
||||
resize2fs "$device"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create backing directories for unionfs-fuse.
|
||||
if [ "$fsType" = unionfs-fuse ]; then
|
||||
for i in $(IFS=:; echo ${options##*,dirs=}); do
|
||||
@@ -303,7 +316,7 @@ mountFS() {
|
||||
|
||||
echo "mounting $device on $mountPoint..."
|
||||
|
||||
mkdir -p "/mnt-root$mountPoint" || true
|
||||
mkdir -p "/mnt-root$mountPoint"
|
||||
|
||||
# For CIFS mounts, retry a few times before giving up.
|
||||
local n=0
|
||||
@@ -375,7 +388,7 @@ while read -u 3 mountPoint; do
|
||||
|
||||
# Wait once more for the udev queue to empty, just in case it's
|
||||
# doing something with $device right now.
|
||||
udevadm settle || true
|
||||
udevadm settle
|
||||
|
||||
mountFS "$device" "$mountPoint" "$options" "$fsType"
|
||||
done
|
||||
@@ -388,9 +401,9 @@ exec 3>&-
|
||||
|
||||
# Emit a udev rule for /dev/root to prevent systemd from complaining.
|
||||
if [ -e /mnt-root/iso ]; then
|
||||
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/mnt-root/iso || true)
|
||||
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/mnt-root/iso)
|
||||
else
|
||||
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true)
|
||||
eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot)
|
||||
fi
|
||||
if [ "$ROOT_MAJOR" -a "$ROOT_MINOR" -a "$ROOT_MAJOR" != 0 ]; then
|
||||
mkdir -p /run/udev/rules.d
|
||||
@@ -399,7 +412,7 @@ fi
|
||||
|
||||
|
||||
# Stop udevd.
|
||||
udevadm control --exit || true
|
||||
udevadm control --exit
|
||||
|
||||
# Kill any remaining processes, just to be sure we're not taking any
|
||||
# with us into stage 2. But keep storage daemons like unionfs-fuse.
|
||||
|
||||
@@ -70,6 +70,12 @@ let
|
||||
copy_bin_and_libs ${pkgs.kmod}/bin/kmod
|
||||
ln -sf kmod $out/bin/modprobe
|
||||
|
||||
# Copy resize2fs if needed.
|
||||
${optionalString (any (fs: fs.autoResize) (attrValues config.fileSystems)) ''
|
||||
# We need mke2fs in the initrd.
|
||||
copy_bin_and_libs ${pkgs.e2fsprogs}/sbin/resize2fs
|
||||
''}
|
||||
|
||||
${config.boot.initrd.extraUtilsCommands}
|
||||
|
||||
# Copy ld manually since it isn't detected correctly
|
||||
@@ -393,7 +399,6 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
system.build.bootStage1 = bootStage1;
|
||||
system.build.initialRamdisk = initialRamdisk;
|
||||
system.build.extraUtils = extraUtils;
|
||||
|
||||
@@ -444,6 +444,17 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.generators = mkOption {
|
||||
type = types.attrsOf types.path;
|
||||
default = {};
|
||||
example = { "systemd-gpt-auto-generator" = "/dev/null"; };
|
||||
description = ''
|
||||
Definition of systemd generators.
|
||||
For each <literal>NAME = VALUE</literal> pair of the attrSet, a link is generated from
|
||||
<literal>/etc/systemd/system-generators/NAME</literal> to <literal>VALUE</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.defaultUnit = mkOption {
|
||||
default = "multi-user.target";
|
||||
type = types.str;
|
||||
@@ -600,20 +611,17 @@ in
|
||||
|
||||
environment.systemPackages = [ systemd ];
|
||||
|
||||
environment.etc."systemd/system".source =
|
||||
generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants;
|
||||
environment.etc = {
|
||||
"systemd/system".source = generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants;
|
||||
|
||||
environment.etc."systemd/user".source =
|
||||
generateUnits "user" cfg.user.units upstreamUserUnits [];
|
||||
"systemd/user".source = generateUnits "user" cfg.user.units upstreamUserUnits [];
|
||||
|
||||
environment.etc."systemd/system.conf".text =
|
||||
''
|
||||
"systemd/system.conf".text = ''
|
||||
[Manager]
|
||||
${config.systemd.extraConfig}
|
||||
'';
|
||||
|
||||
environment.etc."systemd/journald.conf".text =
|
||||
''
|
||||
"systemd/journald.conf".text = ''
|
||||
[Journal]
|
||||
RateLimitInterval=${config.services.journald.rateLimitInterval}
|
||||
RateLimitBurst=${toString config.services.journald.rateLimitBurst}
|
||||
@@ -624,17 +632,26 @@ in
|
||||
${config.services.journald.extraConfig}
|
||||
'';
|
||||
|
||||
environment.etc."systemd/logind.conf".text =
|
||||
''
|
||||
"systemd/logind.conf".text = ''
|
||||
[Login]
|
||||
${config.services.logind.extraConfig}
|
||||
'';
|
||||
|
||||
environment.etc."systemd/sleep.conf".text =
|
||||
''
|
||||
"systemd/sleep.conf".text = ''
|
||||
[Sleep]
|
||||
'';
|
||||
|
||||
"tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf";
|
||||
"tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
|
||||
|
||||
"tmpfiles.d/nixos.conf".text = ''
|
||||
# This file is created automatically and should not be modified.
|
||||
# Please change the option ‘systemd.tmpfiles.rules’ instead.
|
||||
|
||||
${concatStringsSep "\n" cfg.tmpfiles.rules}
|
||||
'';
|
||||
} // mapAttrs' (n: v: nameValuePair "systemd/system-generators/${n}" {"source"=v;}) cfg.generators;
|
||||
|
||||
system.activationScripts.systemd = stringAfter [ "groups" ]
|
||||
''
|
||||
mkdir -m 0755 -p /var/lib/udev
|
||||
@@ -735,17 +752,6 @@ in
|
||||
startSession = true;
|
||||
};
|
||||
|
||||
environment.etc."tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf";
|
||||
environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf";
|
||||
|
||||
environment.etc."tmpfiles.d/nixos.conf".text =
|
||||
''
|
||||
# This file is created automatically and should not be modified.
|
||||
# Please change the option ‘systemd.tmpfiles.rules’ instead.
|
||||
|
||||
${concatStringsSep "\n" cfg.tmpfiles.rules}
|
||||
'';
|
||||
|
||||
# Some overrides to upstream units.
|
||||
systemd.services."systemd-backlight@".restartIfChanged = false;
|
||||
systemd.services."systemd-rfkill@".restartIfChanged = false;
|
||||
|
||||
Reference in New Issue
Block a user