Skip to content

Commit

Permalink
feat: works with sysuser
Browse files Browse the repository at this point in the history
  • Loading branch information
oluceps committed Apr 6, 2024
1 parent 1381a75 commit b4923d7
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion modules/age.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ with lib; let

users = config.users.users;

sysusersEnabled = options.systemd ? sysusers;

mountCommand =
if isDarwin
then ''
Expand Down Expand Up @@ -262,7 +264,28 @@ in {
];
}

(optionalAttrs (!isDarwin) {
(optionalAttrs sysusersEnabled {
# When using sysusers we no longer be started as an activation script because those
# are started in initrd while sysusers is started later.
systemd.services.agenix-install-secrets = {
wantedBy = ["sysinit.target"];
after = ["systemd-sysusers.service"];
unitConfig.DefaultDependencies = "no";

serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "agenix-install" (
builtins.concatStringsSep "\n" [
newGeneration
installSecrets
chownSecrets
]
);
RemainAfterExit = true;
};
};
})
(optionalAttrs (!isDarwin && !sysusersEnabled) {
# Create a new directory full of secrets for symlinking (this helps
# ensure removed secrets are actually removed, or at least become
# invalid symlinks).
Expand Down

0 comments on commit b4923d7

Please sign in to comment.