diff options
author | nikstur <nikstur@outlook.com> | 2023-10-17 21:39:51 +0200 |
---|---|---|
committer | nikstur <nikstur@outlook.com> | 2023-10-25 23:43:58 +0200 |
commit | cb08d3dd72f51fd20d26c823204faa11d742cfe1 (patch) | |
tree | b3a9b28fdbd7463541bdd53e3e44467bf38b9472 /nixos/modules/config | |
parent | a8f50f991948b91d1a191d1348bfff860a39b5a2 (diff) | |
download | nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.tar nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.tar.gz nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.tar.bz2 nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.tar.lz nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.tar.xz nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.tar.zst nixlib-cb08d3dd72f51fd20d26c823204faa11d742cfe1.zip |
nixos/nix-channel: replace activationScript via tmpfiles
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/nix-channel.nix | 11 |
1 files changed, 4 insertions, 7 deletions
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"'' + ]; }; } |