about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2018-10-02 19:21:34 +0100
committerGitHub <noreply@github.com>2018-10-02 19:21:34 +0100
commitb12c759f76fbd901341aa6ca78fb38a192ef334b (patch)
tree9690df9916e6e14b1d9c1906f3dd30ddef2c887c /nixos/modules/system
parent4d1abc44199c8957105f538119c2d19d67aee26f (diff)
parentb63f65aea0dea11c20e9299210af1d2ee4299b58 (diff)
downloadnixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.tar
nixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.tar.gz
nixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.tar.bz2
nixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.tar.lz
nixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.tar.xz
nixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.tar.zst
nixlib-b12c759f76fbd901341aa6ca78fb38a192ef334b.zip
Merge pull request #47563 from jameysharp/unscripted
Replace several activation script snippets with declarative configuration
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/activation-script.nix8
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh8
-rw-r--r--nixos/modules/system/boot/systemd.nix14
3 files changed, 9 insertions, 21 deletions
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 93a1b13a81dd..cd6dc1fb8201 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -128,14 +128,6 @@ in
       ''
         # Various log/runtime directories.
 
-        mkdir -m 0755 -p /run/nix/current-load # for distributed builds
-        mkdir -m 0700 -p /run/nix/remote-stores
-
-        mkdir -m 0755 -p /var/log
-
-        touch /var/log/wtmp /var/log/lastlog # must exist
-        chmod 644 /var/log/wtmp /var/log/lastlog
-
         mkdir -m 1777 -p /var/tmp
 
         # Empty, immutable home directory of many system accounts.
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 49764b75a557..03daafa1ce4f 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -152,6 +152,14 @@ ln -sfn /run/booted-system /nix/var/nix/gcroots/booted-system
 @shell@ @postBootCommands@
 
 
+# Ensure systemd doesn't try to populate /etc, by forcing its first-boot
+# heuristic off. It doesn't matter what's in /etc/machine-id for this purpose,
+# and systemd will immediately fill in the file when it starts, so just
+# creating it is enough. This `: >>` pattern avoids forking and avoids changing
+# the mtime if the file already exists.
+: >> /etc/machine-id
+
+
 # Reset the logging file descriptors.
 exec 1>&$logOutFd 2>&$logErrFd
 exec {logOutFd}>&- {logErrFd}>&-
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index 3ac4c02b61f5..a1412bc32904 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -747,6 +747,7 @@ in
 
       "systemd/journald.conf".text = ''
         [Journal]
+        Storage=persistent
         RateLimitInterval=${config.services.journald.rateLimitInterval}
         RateLimitBurst=${toString config.services.journald.rateLimitBurst}
         ${optionalString (config.services.journald.console != "") ''
@@ -783,19 +784,6 @@ in
 
     services.dbus.enable = true;
 
-    system.activationScripts.systemd = stringAfter [ "groups" ]
-      ''
-        mkdir -m 0755 -p /var/lib/udev
-
-        if ! [ -e /etc/machine-id ]; then
-          ${systemd}/bin/systemd-machine-id-setup
-        fi
-
-        # Keep a persistent journal. Note that systemd-tmpfiles will
-        # set proper ownership/permissions.
-        mkdir -m 0700 -p /var/log/journal
-      '';
-
     users.users.systemd-network.uid = config.ids.uids.systemd-network;
     users.groups.systemd-network.gid = config.ids.gids.systemd-network;
     users.users.systemd-resolve.uid = config.ids.uids.systemd-resolve;