2023-12-26 00:48:43 -05:00
|
|
|
{
|
|
|
|
config,
|
2024-05-01 10:21:27 -04:00
|
|
|
nix-eval-jobs,
|
|
|
|
nix-fast-build,
|
2023-12-26 00:48:43 -05:00
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-01-09 13:13:04 -05:00
|
|
|
inherit (config.vars) mainUser;
|
|
|
|
inherit (config.sops) secrets;
|
2024-04-22 13:51:31 -04:00
|
|
|
|
2024-05-29 21:18:50 -04:00
|
|
|
nix-eval-jobsPkg =
|
|
|
|
nix-eval-jobs.packages.${pkgs.system}.default.override {
|
|
|
|
nix = config.nix.package;
|
|
|
|
}
|
|
|
|
// {
|
|
|
|
nix = config.nix.package;
|
|
|
|
};
|
|
|
|
|
2024-05-01 10:21:27 -04:00
|
|
|
nix-fast-buildPkg = nix-fast-build.packages.${pkgs.system}.nix-fast-build.override {
|
2024-05-29 21:18:50 -04:00
|
|
|
nix-eval-jobs = nix-eval-jobsPkg;
|
2024-04-22 13:51:31 -04:00
|
|
|
};
|
2023-12-26 00:48:43 -05:00
|
|
|
in {
|
|
|
|
services.nix-serve = {
|
|
|
|
enable = true;
|
|
|
|
secretKeyFile = secrets.binary-cache-key.path;
|
|
|
|
};
|
|
|
|
|
2024-04-22 13:51:31 -04:00
|
|
|
environment.systemPackages = [
|
|
|
|
nix-fast-buildPkg
|
2024-04-14 15:02:19 -04:00
|
|
|
];
|
|
|
|
|
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
|
|
|
|
2024-05-04 20:43:07 -04:00
|
|
|
path =
|
|
|
|
[
|
|
|
|
nix-fast-buildPkg
|
|
|
|
]
|
|
|
|
++ (with pkgs; [
|
|
|
|
git
|
|
|
|
openssh
|
|
|
|
]);
|
2023-12-27 11:39:38 -05:00
|
|
|
|
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
|
2024-04-22 13:51:31 -04:00
|
|
|
nix-fast-build
|
2023-12-27 11:39:38 -05:00
|
|
|
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
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|