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

View file

@ -50,6 +50,30 @@ in
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.
aux.system = {
# Enable to allow unfree (e.g. closed source) packages.

View file

@ -8,20 +8,6 @@
let
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
{
options = {
@ -76,7 +62,7 @@ in
Type = "oneshot";
User = "root";
};
path = pathPkgs;
path = config.aux.system.corePackages;
# Git diffing strategy courtesy of https://stackoverflow.com/a/40255467
script = ''
cd ${cfg.configDir}
@ -112,7 +98,7 @@ in
Type = "oneshot";
User = cfg.user;
};
path = pathPkgs;
path = config.aux.system.corePackages;
script = ''
set -eu
cd ${cfg.configDir}

View file

@ -10,29 +10,40 @@ let
in
{
options = {
aux.system.packages = lib.mkOption {
description = "Additional system packages to install. This is just a wrapper for environment.systemPackages.";
type = lib.types.listOf lib.types.package;
default = [ ];
example = lib.literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
aux.system = {
packages = lib.mkOption {
description = "Additional system packages to install. This is just a wrapper for environment.systemPackages.";
type = lib.types.listOf lib.types.package;
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 = {
# Set up the environment
environment = {
# 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
]);
};
# Install base packages
environment.systemPackages = cfg.corePackages ++ cfg.packages;
services = {
# Enable fwupd (firmware updater)