about summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-2-init.sh
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2022-03-23 15:56:23 +0100
committerJanne Heß <janne@hess.ooo>2022-03-30 20:24:27 +0200
commita3e0698bf6fd676d96b89bdb4cd54c73ea502746 (patch)
tree750875589062bfee5f9fcefa7b7a5e691ae3e347 /nixos/modules/system/boot/stage-2-init.sh
parentd56076aa39859f675bbdc64ea148664406db3278 (diff)
nixos/systemd: Switch to ManagerEnvironment=
This accomplishes multiple things:
- Allows us to start systemd without stage-2-init.sh. This was not
  possible before because the environment would have been wrong
- `systemctl daemon-reexec` also changes the environment, giving us
  newer tools for the fs packages
- Starts systemd in a fully clean environment, making everything more
  consistent and pure
Diffstat (limited to 'nixos/modules/system/boot/stage-2-init.sh')
-rwxr-xr-xnixos/modules/system/boot/stage-2-init.sh8
1 files changed, 2 insertions, 6 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index a90f58042d2d6..9a9d35c08db9b 100755
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -167,10 +167,6 @@ exec 1>&$logOutFd 2>&$logErrFd
 exec {logOutFd}>&- {logErrFd}>&-
 
 
-# Start systemd.
+# Start systemd in a clean environment.
 echo "starting systemd..."
-
-PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \
-    LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive @systemdUnitPathEnvVar@ \
-    TZDIR=/etc/zoneinfo \
-    exec @systemdExecutable@
+exec env - @systemdExecutable@ "$@"