2023-12-26 00:48:43 -05:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-01-09 13:13:04 -05:00
|
|
|
inherit (config.vars) mainUser;
|
|
|
|
inherit (config.sops) secrets;
|
2023-12-26 00:48:43 -05:00
|
|
|
in {
|
|
|
|
services.nix-serve = {
|
|
|
|
enable = true;
|
|
|
|
secretKeyFile = secrets.binary-cache-key.path;
|
|
|
|
};
|
|
|
|
|
2023-12-27 11:39:38 -05:00
|
|
|
# Populate cache
|
2023-12-26 00:48:43 -05:00
|
|
|
systemd = {
|
|
|
|
services.buildAll = {
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
2024-01-09 13:13:04 -05:00
|
|
|
User = mainUser;
|
|
|
|
Group = config.users.users.${mainUser}.group;
|
2023-12-26 00:48:43 -05:00
|
|
|
};
|
2023-12-27 11:39:38 -05:00
|
|
|
|
|
|
|
path = with pkgs; [
|
|
|
|
git
|
|
|
|
nix
|
|
|
|
nixci
|
|
|
|
openssh
|
|
|
|
];
|
|
|
|
|
2023-12-26 00:48:43 -05:00
|
|
|
script = ''
|
|
|
|
cd /tmp
|
2024-01-30 14:56:47 -05:00
|
|
|
if [[ -d ./nix-clone ]]; then
|
|
|
|
rm -r ./nix-clone
|
|
|
|
fi
|
2023-12-27 11:39:38 -05:00
|
|
|
git clone https://git.nelim.org/matt1432/nixos-configs.git nix-clone
|
|
|
|
cd nix-clone
|
|
|
|
nix flake update
|
|
|
|
nixci .
|
|
|
|
cd ..
|
|
|
|
rm -r nix-clone
|
2023-12-26 00:48:43 -05:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
timers.buildAll = {
|
|
|
|
wantedBy = ["timers.target"];
|
|
|
|
partOf = ["buildAll.service"];
|
2023-12-27 11:39:38 -05:00
|
|
|
timerConfig.OnCalendar = ["0:00:00"];
|
2023-12-26 00:48:43 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|