Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test: verify activator handled nixos request in e2e

sow-69

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+34 -19
+27 -19
nix/home/module.nix
··· 51 51 (lib.mkIf pkgs.stdenv.isLinux { 52 52 systemd.user.services.sower-agent = { 53 53 Service = { 54 - Environment = 55 - [ 56 - "PATH=/run/current-system/sw/bin:${lib.makeBinPath [ config.nix.package cfg.activatorPackage ]}" 57 - "SOWER_CONFIG_FILE=%E/sower/client.json" 58 - "RELEASE_MODE=interactive" 59 - "SHELL=${lib.getExe pkgs.bash}" 60 - ] 61 - ++ lib.optionals (cfg.accessTokenFile != null) [ 62 - "SOWER_ACCESS_TOKEN_FILE=${cfg.accessTokenFile}" 63 - ]; 54 + Environment = [ 55 + "PATH=/run/current-system/sw/bin:${ 56 + lib.makeBinPath [ 57 + config.nix.package 58 + cfg.activatorPackage 59 + ] 60 + }" 61 + "SOWER_CONFIG_FILE=%E/sower/client.json" 62 + "RELEASE_MODE=interactive" 63 + "SHELL=${lib.getExe pkgs.bash}" 64 + ] 65 + ++ lib.optionals (cfg.accessTokenFile != null) [ 66 + "SOWER_ACCESS_TOKEN_FILE=${cfg.accessTokenFile}" 67 + ]; 64 68 65 69 ExecStartPre = pkgs.writeShellScript "sower-agent-init" '' 66 70 mkdir -p ${stateDir} ··· 119 123 (lib.getExe cfg.package) 120 124 "start" 121 125 ]; 122 - EnvironmentVariables = 123 - { 124 - PATH = "/run/current-system/sw/bin:${lib.makeBinPath [ config.nix.package cfg.activatorPackage ]}"; 125 - SOWER_CONFIG_FILE = "${config.xdg.configHome}/sower/client.json"; 126 - RELEASE_MODE = "interactive"; 127 - } 128 - // lib.optionalAttrs (cfg.accessTokenFile != null) { 129 - SOWER_ACCESS_TOKEN_FILE = cfg.accessTokenFile; 130 - }; 126 + EnvironmentVariables = { 127 + PATH = "/run/current-system/sw/bin:${ 128 + lib.makeBinPath [ 129 + config.nix.package 130 + cfg.activatorPackage 131 + ] 132 + }"; 133 + SOWER_CONFIG_FILE = "${config.xdg.configHome}/sower/client.json"; 134 + RELEASE_MODE = "interactive"; 135 + } 136 + // lib.optionalAttrs (cfg.accessTokenFile != null) { 137 + SOWER_ACCESS_TOKEN_FILE = cfg.accessTokenFile; 138 + }; 131 139 StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/sower-agent-err.log"; 132 140 StandardOutPath = "${config.home.homeDirectory}/Library/Logs/sower-agent-out.log"; 133 141 };
+7
nix/tests/e2e.nix
··· 219 219 timeout=15, 220 220 ) 221 221 222 + with subtest("activator handled nixos request"): 223 + server.succeed( 224 + "journalctl --no-pager -u 'sower-activator@*'" 225 + " --grep='Received request.*type=nixos'" 226 + ) 227 + 222 228 with subtest("start home-manager agent"): 223 229 server.wait_for_unit("home-manager-testuser.service") 224 230 server.succeed("loginctl enable-linger testuser") ··· 253 259 " --grep=Completed.activation'", 254 260 timeout=15, 255 261 ) 262 + 256 263 ''; 257 264 }