Improve update-timer
This commit is contained in:
parent
2a2c5369bb
commit
35c73a4f8f
4 changed files with 52 additions and 46 deletions
|
@ -1,30 +1,7 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }: {
|
||||||
let user = "maralorn";
|
|
||||||
in {
|
|
||||||
|
|
||||||
imports = [ ./init_ssh.nix ];
|
imports = [ ./init_ssh.nix ];
|
||||||
|
|
||||||
systemd.services.test-and-update = {
|
|
||||||
startAt = "2:45";
|
|
||||||
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 = ''
|
|
||||||
${(import ../../lib/test.nix).test-config}/bin/test-config
|
|
||||||
/run/wrappers/bin/sudo -u ${user} git -C /etc/nixos pull
|
|
||||||
${
|
|
||||||
(import ../../lib/update-system.nix
|
|
||||||
config.system.build.nixos-rebuild).update-system
|
|
||||||
}/bin/update-system
|
|
||||||
/run/wrappers/bin/sudo -u ${user} update-home
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
nix = {
|
nix = {
|
||||||
gc.automatic = true;
|
gc.automatic = true;
|
||||||
optimise.automatic = true;
|
optimise.automatic = true;
|
||||||
|
|
|
@ -1,5 +1,33 @@
|
||||||
{ pkgs, config, lib, ... }: {
|
{ pkgs, config, lib, ... }:
|
||||||
systemd.services."test-and-bump-config" = {
|
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 = {
|
||||||
|
startAt = "2:45";
|
||||||
|
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
|
||||||
|
${update-system}/bin/update-system
|
||||||
|
/run/wrappers/bin/sudo -u ${user} ${update-home}/bin/update-home
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
test-and-bump-config = {
|
||||||
startAt = "20:30";
|
startAt = "20:30";
|
||||||
path = [ pkgs.nix pkgs.gnutar pkgs.gzip pkgs.git pkgs.git-crypt ];
|
path = [ pkgs.nix pkgs.gnutar pkgs.gzip pkgs.git pkgs.git-crypt ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
@ -9,4 +37,5 @@
|
||||||
"${(import ../lib/test.nix).test-config}/bin/test-config bump";
|
"${(import ../lib/test.nix).test-config}/bin/test-config bump";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue