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}";
|
Unit.Description = "ssh-cert-dist service for ${path}";
|
||||||
Service = {
|
Service = {
|
||||||
Environment = "RUST_LOG=debug";
|
Environment = "RUST_LOG=debug";
|
||||||
ExecStart = toString (pkgs.writeShellApplication {
|
ExecStart = "${pkgs.writeShellApplication {
|
||||||
name = "ssh-cert-dist-${options.name}";
|
name = "sshcd";
|
||||||
runtimeInputs = [ cfg.package ];
|
runtimeInputs = [ cfg.package ];
|
||||||
text = ''
|
text = ''
|
||||||
${optionalString options.fetch ''
|
${optionalString options.fetch ''
|
||||||
@ -22,11 +22,23 @@ in
|
|||||||
sshcd upload --api-endpoint '${cfg.endpoint}' ${path}/*
|
sshcd upload --api-endpoint '${cfg.endpoint}' ${path}/*
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
});
|
}}/bin/sshcd";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
cfg.directories);
|
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) {
|
config.home.sessionVariables = mkIf (cfg.enable && cfg.endpoint != null) {
|
||||||
SSH_CD_API = cfg.endpoint;
|
SSH_CD_API = cfg.endpoint;
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,11 @@
|
|||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
interval = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "daily";
|
||||||
|
description = "https://www.freedesktop.org/software/systemd/man/systemd.time.html";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
endpointOption = mkOption {
|
endpointOption = mkOption {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user