about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2023-10-28 10:17:15 +0200
committerGitHub <noreply@github.com>2023-10-28 10:17:15 +0200
commit86707945659e730bc7af48969d0898a765ee4c05 (patch)
treeb41cdb205107c50ab64e1148d9383540dcf79f0e /nixos/modules/config
parent0643b928c86e6f8e1786ad2ffb666331a42add51 (diff)
parentd300940637a74421b78d3e94b25daf35f1b9ec9d (diff)
downloadnixlib-86707945659e730bc7af48969d0898a765ee4c05.tar
nixlib-86707945659e730bc7af48969d0898a765ee4c05.tar.gz
nixlib-86707945659e730bc7af48969d0898a765ee4c05.tar.bz2
nixlib-86707945659e730bc7af48969d0898a765ee4c05.tar.lz
nixlib-86707945659e730bc7af48969d0898a765ee4c05.tar.xz
nixlib-86707945659e730bc7af48969d0898a765ee4c05.tar.zst
nixlib-86707945659e730bc7af48969d0898a765ee4c05.zip
Merge pull request #263203 from nikstur/replace-activation
Replace simple activationScripts 
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/mysql.nix4
-rw-r--r--nixos/modules/config/nix-channel.nix11
2 files changed, 6 insertions, 9 deletions
diff --git a/nixos/modules/config/mysql.nix b/nixos/modules/config/mysql.nix
index 2f13c56f2ae5..95c9ba76663e 100644
--- a/nixos/modules/config/mysql.nix
+++ b/nixos/modules/config/mysql.nix
@@ -429,11 +429,11 @@ in
       '';
     };
 
-    # Activation script to append the password from the password file
+    # preStart script to append the password from the password file
     # to the configuration files. It also fixes the owner of the
     # libnss-mysql-root.cfg because it is changed to root after the
     # password is appended.
-    system.activationScripts.mysql-auth-passwords = ''
+    systemd.services.mysql.preStart = ''
       if [[ -r ${cfg.passwordFile} ]]; then
         org_umask=$(umask)
         umask 0077
diff --git a/nixos/modules/config/nix-channel.nix b/nixos/modules/config/nix-channel.nix
index 3f8e088ede92..4abc846b0858 100644
--- a/nixos/modules/config/nix-channel.nix
+++ b/nixos/modules/config/nix-channel.nix
@@ -97,12 +97,9 @@ in
 
     nix.settings.nix-path = mkIf (! cfg.channel.enable) (mkDefault "");
 
-    system.activationScripts.nix-channel = mkIf cfg.channel.enable
-      (stringAfter [ "etc" "users" ] ''
-        # Subscribe the root user to the NixOS channel by default.
-        if [ ! -e "/root/.nix-channels" ]; then
-            echo "${config.system.defaultChannel} nixos" > "/root/.nix-channels"
-        fi
-      '');
+    systemd.tmpfiles.rules = lib.mkIf cfg.channel.enable [
+      "f /root/.nix-channels -"
+      ''w "/root/.nix-channels" - - - - "${config.system.defaultChannel} nixos\n"''
+    ];
   };
 }