From cb08d3dd72f51fd20d26c823204faa11d742cfe1 Mon Sep 17 00:00:00 2001 From: nikstur Date: Tue, 17 Oct 2023 21:39:51 +0200 Subject: nixos/nix-channel: replace activationScript via tmpfiles --- nixos/modules/config/nix-channel.nix | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'nixos/modules/config') diff --git a/nixos/modules/config/nix-channel.nix b/nixos/modules/config/nix-channel.nix index 3f8e088ede9..4abc846b085 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"'' + ]; }; } -- cgit 1.4.1