Add build-flakes script for nix-cache
Some checks failed
Run nix flake check / flake-check (push) Failing after 4m20s
Some checks failed
Run nix flake check / flake-check (push) Failing after 4m20s
This commit is contained in:
parent
5ef2b3aafa
commit
e70e892ab2
@ -2,5 +2,6 @@
|
||||
{
|
||||
imports = [
|
||||
./configuration.nix
|
||||
../../services/nix-cache
|
||||
];
|
||||
}
|
||||
|
@ -138,6 +138,7 @@
|
||||
"ns2.home.2rjus.net:9100"
|
||||
"http-proxy.home.2rjus.net:9100"
|
||||
"ha1.home.2rjus.net:9100"
|
||||
"nix-cache01.home.2rjus.net:9100"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
42
services/nix-cache/build-flakes.nix
Normal file
42
services/nix-cache/build-flakes.nix
Normal file
@ -0,0 +1,42 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
build-flake-script = pkgs.writeShellApplication {
|
||||
name = "build-flake-script";
|
||||
runtimeInputs = with pkgs; [
|
||||
git
|
||||
nix
|
||||
nixos-rebuild
|
||||
jq
|
||||
];
|
||||
text = ''
|
||||
cd /root/nixos-servers
|
||||
git pull
|
||||
echo "Starting nixos-servers builds"
|
||||
for host in $(nix flake show --json| jq -r '.nixosConfigurations | keys[]'); do
|
||||
echo "Building $host"
|
||||
nixos-rebuild --verbose -L --flake ".#$host" build
|
||||
done
|
||||
echo "All nixos-servers builds complete"
|
||||
|
||||
echo "Building gunter"
|
||||
cd /root/nixos
|
||||
git pull
|
||||
nixos-rebuild --verbose -L --flake ".#gunter" build
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
systemd.services."build-flakes" = {
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${build-flake-script}/bin/build-flake-script";
|
||||
};
|
||||
};
|
||||
systemd.timers."build-flakes" = {
|
||||
enable = true;
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "Sun 06:00:00";
|
||||
};
|
||||
};
|
||||
}
|
6
services/nix-cache/default.nix
Normal file
6
services/nix-cache/default.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./build-flakes.nix
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue
Block a user