diff --git a/modules/services/hardware/udev.nix b/modules/services/hardware/udev.nix index d558d2983cf9..e1a338d6ad8b 100644 --- a/modules/services/hardware/udev.nix +++ b/modules/services/hardware/udev.nix @@ -6,7 +6,7 @@ let inherit (pkgs) stdenv writeText procps; - udev = config.system.build.systemd; + udev = config.systemd.package; cfg = config.services.udev; diff --git a/modules/services/hardware/upower.nix b/modules/services/hardware/upower.nix index 54f5d03de391..5d1658adb75f 100644 --- a/modules/services/hardware/upower.nix +++ b/modules/services/hardware/upower.nix @@ -56,7 +56,7 @@ with pkgs.lib; # the daemon. powerManagement.resumeCommands = '' - ${config.system.build.systemd}/bin/systemctl try-restart upower + ${config.systemd.package}/bin/systemctl try-restart upower ''; }; diff --git a/modules/services/misc/nix-gc.nix b/modules/services/misc/nix-gc.nix index dc9fa85cf667..280450446016 100644 --- a/modules/services/misc/nix-gc.nix +++ b/modules/services/misc/nix-gc.nix @@ -49,7 +49,7 @@ in config = { services.cron.systemCronJobs = mkIf cfg.automatic (singleton - "${cfg.dates} root ${config.system.build.systemd}/bin/systemctl start nix-gc.service"); + "${cfg.dates} root ${config.systemd.package}/bin/systemctl start nix-gc.service"); systemd.services."nix-gc" = { description = "Nix Garbage Collector"; diff --git a/modules/services/networking/dhcpcd.nix b/modules/services/networking/dhcpcd.nix index 533b719a6675..342253bac296 100644 --- a/modules/services/networking/dhcpcd.nix +++ b/modules/services/networking/dhcpcd.nix @@ -57,13 +57,13 @@ let # server hostnames in its config file, then it will never do # anything ever again ("couldn't resolve ..., giving up on # it"), so we silently lose time synchronisation. - ${config.system.build.systemd}/bin/systemctl try-restart ntpd.service + ${config.systemd.package}/bin/systemctl try-restart ntpd.service - ${config.system.build.systemd}/bin/systemctl start ip-up.target + ${config.systemd.package}/bin/systemctl start ip-up.target fi #if [ "$reason" = EXPIRE -o "$reason" = RELEASE -o "$reason" = NOCARRIER ] ; then - # ${config.system.build.systemd}/bin/systemctl start ip-down.target + # ${config.systemd.package}/bin/systemctl start ip-down.target #fi ''; @@ -126,7 +126,7 @@ in powerManagement.resumeCommands = '' # Tell dhcpcd to rebind its interfaces if it's running. - ${config.system.build.systemd}/bin/systemctl reload dhcpcd.service + ${config.systemd.package}/bin/systemctl reload dhcpcd.service ''; }; diff --git a/modules/services/networking/networkmanager.nix b/modules/services/networking/networkmanager.nix index d8198dd03298..0daa945c14ac 100644 --- a/modules/services/networking/networkmanager.nix +++ b/modules/services/networking/networkmanager.nix @@ -39,7 +39,7 @@ let ipUpScript = pkgs.writeScript "01nixos-ip-up" '' #!/bin/sh if test "$2" = "up"; then - ${config.system.build.systemd}/bin/systemctl start ip-up.target + ${config.systemd.package}/bin/systemctl start ip-up.target fi ''; diff --git a/modules/services/networking/wpa_supplicant.nix b/modules/services/networking/wpa_supplicant.nix index 4f8ae55d2090..20752cdee259 100644 --- a/modules/services/networking/wpa_supplicant.nix +++ b/modules/services/networking/wpa_supplicant.nix @@ -124,7 +124,7 @@ in powerManagement.resumeCommands = '' - ${config.system.build.systemd}/bin/systemctl try-restart wpa_supplicant + ${config.systemd.package}/bin/systemctl try-restart wpa_supplicant ''; assertions = [{ assertion = !cfg.userControlled.enable || cfg.interfaces != []; diff --git a/modules/services/x11/display-managers/default.nix b/modules/services/x11/display-managers/default.nix index 396311be49e1..1f842c0c9534 100644 --- a/modules/services/x11/display-managers/default.nix +++ b/modules/services/x11/display-managers/default.nix @@ -36,7 +36,7 @@ let # since presumably the desktop environment will handle these. if [ -z "$_INHIBITION_LOCK_TAKEN" ]; then export _INHIBITION_LOCK_TAKEN=1 - exec ${config.system.build.systemd}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType" + exec ${config.systemd.package}/bin/systemd-inhibit --what=handle-lid-switch:handle-power-key "$0" "$sessionType" fi ${optionalString cfg.startOpenSSHAgent '' diff --git a/modules/services/x11/display-managers/kdm.nix b/modules/services/x11/display-managers/kdm.nix index 08ae667211d4..6a628ec124f2 100644 --- a/modules/services/x11/display-managers/kdm.nix +++ b/modules/services/x11/display-managers/kdm.nix @@ -12,8 +12,8 @@ let defaultConfig = '' [Shutdown] - HaltCmd=${config.system.build.systemd}/sbin/shutdown -h now - RebootCmd=${config.system.build.systemd}/sbin/shutdown -r now + HaltCmd=${config.systemd.package}/sbin/shutdown -h now + RebootCmd=${config.systemd.package}/sbin/shutdown -r now ${optionalString (config.system.boot.loader.id == "grub") '' BootManager=${if config.boot.loader.grub.version == 2 then "Grub2" else "Grub"} ''} diff --git a/modules/services/x11/display-managers/slim.nix b/modules/services/x11/display-managers/slim.nix index bc9aef101c7d..9e8b9391f45f 100644 --- a/modules/services/x11/display-managers/slim.nix +++ b/modules/services/x11/display-managers/slim.nix @@ -14,8 +14,8 @@ let xserver_arguments ${dmcfg.xserverArgs} sessions ${pkgs.lib.concatStringsSep "," (dmcfg.session.names ++ ["custom"])} login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session" - halt_cmd ${config.system.build.systemd}/sbin/shutdown -h now - reboot_cmd ${config.system.build.systemd}/sbin/shutdown -r now + halt_cmd ${config.systemd.package}/sbin/shutdown -h now + reboot_cmd ${config.systemd.package}/sbin/shutdown -r now ${optionalString (cfg.defaultUser != "") ("default_user " + cfg.defaultUser)} ${optionalString cfg.autoLogin "auto_login yes"} ''; diff --git a/modules/system/activation/top-level.nix b/modules/system/activation/top-level.nix index 48c1c0be1896..e99b50a0309d 100644 --- a/modules/system/activation/top-level.nix +++ b/modules/system/activation/top-level.nix @@ -120,7 +120,7 @@ let echo -n "$kernelParams" > $out/kernel-params echo -n "$configurationName" > $out/configuration-name - echo -n "systemd ${toString config.system.build.systemd.interfaceVersion}" > $out/init-interface-version + echo -n "systemd ${toString config.systemd.package.interfaceVersion}" > $out/init-interface-version echo -n "$nixosVersion" > $out/nixos-version mkdir $out/fine-tune @@ -149,7 +149,7 @@ let buildCommand = systemBuilder; inherit (pkgs) utillinux; - inherit (config.system.build) systemd; + systemd = config.systemd.package; inherit children; kernelParams = diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 4776f4451f05..7744fd94a2c8 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -224,7 +224,7 @@ in serviceConfig = { Type = "oneshot"; RemainAfterExit = true; - ExecStart = "${config.system.build.systemd}/lib/systemd/systemd-modules-load"; + ExecStart = "${config.systemd.package}/lib/systemd/systemd-modules-load"; # Ignore failed module loads. Typically some of the # modules in ‘boot.kernelModules’ are "nice to have but # not required" (e.g. acpi-cpufreq), so we don't want to diff --git a/modules/system/boot/stage-1.nix b/modules/system/boot/stage-1.nix index b131867966ab..9743703ffbe6 100644 --- a/modules/system/boot/stage-1.nix +++ b/modules/system/boot/stage-1.nix @@ -9,7 +9,7 @@ with pkgs.lib; let - udev = config.system.build.systemd; + udev = config.systemd.package; options = { diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index 80957cd11930..b76367021206 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -8,7 +8,7 @@ let cfg = config.systemd; - systemd = pkgs.systemd; + systemd = cfg.package; makeUnit = name: unit: pkgs.runCommand "unit" { inherit (unit) text; } @@ -340,6 +340,12 @@ in options = { + systemd.package = mkOption { + default = pkgs.systemd; + type = types.package; + description = "The systemd package."; + }; + systemd.units = mkOption { description = "Definition of systemd units."; default = {}; @@ -457,8 +463,6 @@ in config = { - system.build.systemd = systemd; - system.build.units = units; environment.systemPackages = [ systemd ]; diff --git a/modules/tasks/kbd.nix b/modules/tasks/kbd.nix index b0e222cd05eb..e4d22e94c80c 100644 --- a/modules/tasks/kbd.nix +++ b/modules/tasks/kbd.nix @@ -85,7 +85,7 @@ in serviceConfig = { Type = "oneshot"; RemainAfterExit = true; - ExecStart = "${config.system.build.systemd}/lib/systemd/systemd-vconsole-setup /dev/tty1"; + ExecStart = "${config.systemd.package}/lib/systemd/systemd-vconsole-setup /dev/tty1"; }; restartTriggers = [ vconsoleConf ]; }; diff --git a/modules/tasks/network-interfaces.nix b/modules/tasks/network-interfaces.nix index e8097e418c8b..49dd47251e5d 100644 --- a/modules/tasks/network-interfaces.nix +++ b/modules/tasks/network-interfaces.nix @@ -350,11 +350,11 @@ in ip -4 addr add "${i.ipAddress}/${mask}" dev "${i.name}" # Ensure that the default gateway remains set. # (Flushing this interface may have removed it.) - ${config.system.build.systemd}/bin/systemctl try-restart --no-block network-setup.service + ${config.systemd.package}/bin/systemctl try-restart --no-block network-setup.service else echo "skipping configuring interface" fi - ${config.system.build.systemd}/bin/systemctl start ip-up.target + ${config.systemd.package}/bin/systemctl start ip-up.target '' + optionalString i.proxyARP ''