feat(home-manager): create timer unit
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
1183ba0d73
commit
9d405a6324
@ -11,8 +11,8 @@ in
|
||||
Unit.Description = "ssh-cert-dist service for ${path}";
|
||||
Service = {
|
||||
Environment = "RUST_LOG=debug";
|
||||
ExecStart = toString (pkgs.writeShellApplication {
|
||||
name = "ssh-cert-dist-${options.name}";
|
||||
ExecStart = "${pkgs.writeShellApplication {
|
||||
name = "sshcd";
|
||||
runtimeInputs = [ cfg.package ];
|
||||
text = ''
|
||||
${optionalString options.fetch ''
|
||||
@ -22,11 +22,23 @@ in
|
||||
sshcd upload --api-endpoint '${cfg.endpoint}' ${path}/*
|
||||
''}
|
||||
'';
|
||||
});
|
||||
}}/bin/sshcd";
|
||||
};
|
||||
};
|
||||
})
|
||||
cfg.directories);
|
||||
config.systemd.user.timers = mkIf cfg.enable (mapAttrs'
|
||||
(path: options: {
|
||||
inherit (options) name; value = {
|
||||
Unit.Description = "ssh-cert-dist service for ${path}";
|
||||
Timer = {
|
||||
OnCalendar = options.interval;
|
||||
Unit = "${options.name}.service";
|
||||
};
|
||||
Install.WantedBy = [ "timers.target" ];
|
||||
};
|
||||
})
|
||||
cfg.directories);
|
||||
config.home.sessionVariables = mkIf (cfg.enable && cfg.endpoint != null) {
|
||||
SSH_CD_API = cfg.endpoint;
|
||||
};
|
||||
|
@ -13,6 +13,11 @@
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
interval = mkOption {
|
||||
type = types.str;
|
||||
default = "daily";
|
||||
description = "https://www.freedesktop.org/software/systemd/man/systemd.time.html";
|
||||
};
|
||||
};
|
||||
};
|
||||
endpointOption = mkOption {
|
||||
|
Loading…
x
Reference in New Issue
Block a user