1
0
Fork 0

Dimaga: add weekly task to build derivations for other hosts

This commit is contained in:
Aires 2024-07-25 14:33:47 -04:00
parent 192af9fbf4
commit fe1af48c0d
4 changed files with 66 additions and 45 deletions

View file

@ -138,11 +138,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1721804110, "lastModified": 1721852138,
"narHash": "sha256-i4jINRazBKPqlaS+qhlP+kV/UHEq3vs5itfpblqu4ZM=", "narHash": "sha256-JH8N5uoqoVA6erV4O40VtKKHsnfmhvMGbxMNDLtim5o=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "af70fc502a15d7e1e4c5a4c4fc8e06c2ec561e0c", "rev": "304a011325b7ac7b8c9950333cd215a7aa146b0e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -248,11 +248,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1721839713, "lastModified": 1721911538,
"narHash": "sha256-apTv16L9h5ONS2VTPbKEgwAOVmWGku0MsfprjgwBFHo=", "narHash": "sha256-5OrkPJsiZmNe99C6+KX0qx9sphoVLvldFjuqDYAZ8GQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "a7432ebaefc9a400dcda399d48b949230378d784", "rev": "d3c993c851ad40bbab7e08d566138ff72cd8744f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -296,11 +296,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1721562059, "lastModified": 1721743106,
"narHash": "sha256-Tybxt65eyOARf285hMHIJ2uul8SULjFZbT9ZaEeUnP8=", "narHash": "sha256-adRZhFpBTnHiK3XIELA3IBaApz70HwCYfv7xNrHjebA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "68c9ed8bbed9dfce253cc91560bf9043297ef2fe", "rev": "dc14ed91132ee3a26255d01d8fd0c1f5bff27b2f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -50,6 +50,30 @@ in
hybrid-sleep.enable = false; hybrid-sleep.enable = false;
}; };
# Build Nix packages for other hosts.
# Runs every Saturday at 4 AM
systemd.services."build-hosts" = {
serviceConfig = {
Type = "oneshot";
User = "root";
};
path = config.aux.system.corePackages;
script = ''
cd ${config.secrets.nixConfigFolder}
nh os build --hostname Khanda
'';
};
systemd.timers."build-hosts" = {
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "Sat 04:00";
Persistent = true;
Unit = "build-hosts.service";
};
};
# Configure the system. # Configure the system.
aux.system = { aux.system = {
# Enable to allow unfree (e.g. closed source) packages. # Enable to allow unfree (e.g. closed source) packages.

View file

@ -8,20 +8,6 @@
let let
cfg = config.aux.system.services.autoUpgrade; cfg = config.aux.system.services.autoUpgrade;
# List of packages to include in each service's $PATH
pathPkgs = with pkgs; [
# Courtesy of https://discourse.nixos.org/t/how-to-use-other-packages-binary-in-systemd-service-configuration/14363
coreutils
git
gnutar
gzip
config.nix.package.out
nh
config.programs.ssh.package
sudo
xz.bin
];
in in
{ {
options = { options = {
@ -76,7 +62,7 @@ in
Type = "oneshot"; Type = "oneshot";
User = "root"; User = "root";
}; };
path = pathPkgs; path = config.aux.system.corePackages;
# Git diffing strategy courtesy of https://stackoverflow.com/a/40255467 # Git diffing strategy courtesy of https://stackoverflow.com/a/40255467
script = '' script = ''
cd ${cfg.configDir} cd ${cfg.configDir}
@ -112,7 +98,7 @@ in
Type = "oneshot"; Type = "oneshot";
User = cfg.user; User = cfg.user;
}; };
path = pathPkgs; path = config.aux.system.corePackages;
script = '' script = ''
set -eu set -eu
cd ${cfg.configDir} cd ${cfg.configDir}

View file

@ -10,29 +10,40 @@ let
in in
{ {
options = { options = {
aux.system.packages = lib.mkOption { aux.system = {
description = "Additional system packages to install. This is just a wrapper for environment.systemPackages."; packages = lib.mkOption {
type = lib.types.listOf lib.types.package; description = "Additional system packages to install. This is just a wrapper for environment.systemPackages.";
default = [ ]; type = lib.types.listOf lib.types.package;
example = lib.literalExpression "[ pkgs.firefox pkgs.thunderbird ]"; default = [ ];
example = lib.literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
};
corePackages = lib.mkOption {
description = "Minimum set of packages to install.";
type = lib.types.listOf lib.types.package;
default = with pkgs; [
# Courtesy of https://discourse.nixos.org/t/how-to-use-other-packages-binary-in-systemd-service-configuration/14363
bash
coreutils
dconf
direnv
git
gnutar
gzip
home-manager
lm_sensors
config.nix.package.out
nh
config.programs.ssh.package
sudo
xz.bin
];
};
}; };
}; };
config = { config = {
# Set up the environment # Install base packages
environment = { environment.systemPackages = cfg.corePackages ++ cfg.packages;
# Install base packages
systemPackages =
config.aux.system.packages
++ (with pkgs; [
bash
dconf # Needed to fix an issue with Home-manager. See https://github.com/nix-community/home-manager/issues/3113
direnv
git
home-manager
lm_sensors
p7zip
]);
};
services = { services = {
# Enable fwupd (firmware updater) # Enable fwupd (firmware updater)