ci: switch to a system service

This commit is contained in:
Aaron Bieber 2023-03-03 07:06:30 -07:00
parent efe0d79d01
commit 336973e5b5
No known key found for this signature in database
4 changed files with 16 additions and 4 deletions

View File

@ -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 = {

View File

@ -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; [

View File

@ -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" ];

View File

@ -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