ci: switch to a system service
This commit is contained in:
parent
efe0d79d01
commit
336973e5b5
@ -3,12 +3,14 @@ let
|
||||
jobs = [
|
||||
{
|
||||
name = "xin-ci-update";
|
||||
user = "qbit";
|
||||
script = "cd ~/src/xin && ./bin/ci update";
|
||||
startAt = "23:00";
|
||||
path = [ ];
|
||||
}
|
||||
{
|
||||
name = "xin-ci";
|
||||
user = "qbit";
|
||||
script = "cd ~/src/xin && ./bin/ci";
|
||||
startAt = "*:30:00";
|
||||
path = [ ];
|
||||
@ -63,7 +65,7 @@ in with lib; {
|
||||
settings.allowed-users = [ "root" config.xinCI.user "nix-serve" ];
|
||||
};
|
||||
|
||||
systemd.user.services =
|
||||
systemd.services =
|
||||
lib.listToAttrs (builtins.map xinlib.jobToService jobs);
|
||||
|
||||
services = {
|
||||
|
@ -79,7 +79,7 @@ in with lib; {
|
||||
];
|
||||
|
||||
systemd.user.services =
|
||||
(lib.listToAttrs (builtins.map xinlib.jobToService jobs))
|
||||
(lib.listToAttrs (builtins.map xinlib.jobToUserService jobs))
|
||||
// promnesiaService;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
@ -210,7 +210,7 @@ in {
|
||||
''];
|
||||
|
||||
systemd.user.services =
|
||||
lib.listToAttrs (builtins.map xinlib.jobToService jobs);
|
||||
lib.listToAttrs (builtins.map xinlib.jobToUserService jobs);
|
||||
systemd.services."whytailscalewhy" = {
|
||||
description = "Tailscale restart on resume";
|
||||
wantedBy = [ "post-resume.target" ];
|
||||
|
@ -5,6 +5,16 @@ let
|
||||
# autogenreated ${name}
|
||||
${src}
|
||||
'';
|
||||
jobToUserService = job: {
|
||||
name = "${job.name}";
|
||||
value = {
|
||||
serviceConfig = {
|
||||
User = "${job.user}";
|
||||
};
|
||||
script = mkCronScript "${job.name}_script" job.script;
|
||||
inherit (job) startAt path;
|
||||
};
|
||||
};
|
||||
jobToService = job: {
|
||||
name = "${job.name}";
|
||||
value = {
|
||||
@ -41,6 +51,6 @@ let
|
||||
system.autoUpgrade.enable = state != "DIRTY";
|
||||
};
|
||||
|
||||
xinlib = { inherit buildVer mkCronScript jobToService buildShell; };
|
||||
xinlib = { inherit buildVer mkCronScript jobToUserService jobToService buildShell; };
|
||||
|
||||
in xinlib
|
||||
|
Loading…
Reference in New Issue
Block a user