Compare commits

...

2 Commits

Author SHA1 Message Date
oluceps 5b2aa79807
Merge 96e3a9e275 into 1381a759b2 2024-04-06 20:37:53 +00:00
oluceps 96e3a9e275
feat: works with sysuser
fix: darwin compatible

chore: reformat
2024-04-07 04:37:33 +08:00
1 changed files with 27 additions and 1 deletions

View File

@ -14,6 +14,11 @@ with lib; let
users = config.users.users;
sysusersEnabled =
if isDarwin
then false
else options.systemd ? sysusers;
mountCommand =
if isDarwin
then ''
@ -262,7 +267,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).