1
0
Fork 0
nixos-config/system/test-timer.nix
2020-05-21 17:51:50 +02:00

41 lines
1.3 KiB
Nix

{ pkgs, config, lib, ... }:
let
user = "maralorn";
inherit (import ../lib/test.nix) test-config;
inherit (import ../lib/update-system.nix config.system.build.nixos-rebuild)
update-system;
update-home = (import ../lib/update-home.nix).update-home "/etc/nixos";
in {
systemd.services = {
test-and-update = {
environment.NIX_PATH =
"/etc/nix-path:nixos-config=/etc/nixos/configuration.nix";
path = [ pkgs.nix pkgs.gnutar pkgs.gzip pkgs.git pkgs.git-crypt ];
restartIfChanged = false;
unitConfig.X-StopOnRemoval = false;
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/var/cache/gc-links";
};
script = ''
${test-config}/bin/test-config
/run/wrappers/bin/sudo -u ${user} git -C /etc/nixos pull
result-system-hera/activate
/run/wrappers/bin/sudo -u ${user} result-home-manager-hera/default/activate
'';
};
test-and-bump-config = {
startAt = "03:45";
path = [ pkgs.nix pkgs.gnutar pkgs.gzip pkgs.git pkgs.git-crypt ];
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "/var/cache/gc-links";
ExecStart =
"${(import ../lib/test.nix).test-config}/bin/test-config bump";
};
};
};
}