Skip to content

Commit

Permalink
add activationScript dep
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Aug 15, 2024
1 parent 5c2d2db commit 1cd6be6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions modules/op-secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,20 @@ in {

script = opnixScript;
};
# if no generation already exists, rely on the systemd startup job;
# otherwise, if there already is an existing generation, reprovision
# secrets because we did a nixos-rebuild
system.activationScripts.opnix-on-rebuild.text = ''
${scripts.setOpnixGeneration}
(( _opnix_generation > 1 )) && {
source ${cfg.environmentFile}
export OP_SERVICE_ACCOUNT_TOKEN
${opnixScript}
}
'';
system.activationScripts.opnix-on-rebuild = {
# if no generation already exists, rely on the systemd startup job;
# otherwise, if there already is an existing generation, reprovision
# secrets because we did a nixos-rebuild
text = ''
${scripts.setOpnixGeneration}
(( _opnix_generation > 1 )) && {
source ${cfg.environmentFile}
export OP_SERVICE_ACCOUNT_TOKEN
${opnixScript}
}
'';
deps = [ "userbinenv" ];
};
}
{
systemd.services = builtins.listToAttrs (builtins.map (systemdName: {
Expand Down

0 comments on commit 1cd6be6

Please sign in to comment.