53 lines
1,016 B
Nix
53 lines
1,016 B
Nix
{
|
|
config,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
inherit (config.vars) mainUser;
|
|
inherit (config.sops) secrets;
|
|
in {
|
|
services.nix-serve = {
|
|
enable = true;
|
|
secretKeyFile = secrets.binary-cache-key.path;
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
nixci
|
|
];
|
|
|
|
# Populate cache
|
|
systemd = {
|
|
services.buildAll = {
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
User = mainUser;
|
|
Group = config.users.users.${mainUser}.group;
|
|
};
|
|
|
|
path = with pkgs; [
|
|
git
|
|
nix
|
|
nixci
|
|
openssh
|
|
];
|
|
|
|
script = ''
|
|
cd /tmp
|
|
if [[ -d ./nix-clone ]]; then
|
|
rm -r ./nix-clone
|
|
fi
|
|
git clone https://git.nelim.org/matt1432/nixos-configs.git nix-clone
|
|
cd nix-clone
|
|
nix flake update
|
|
nixci .
|
|
cd ..
|
|
rm -r nix-clone
|
|
'';
|
|
};
|
|
timers.buildAll = {
|
|
wantedBy = ["timers.target"];
|
|
partOf = ["buildAll.service"];
|
|
timerConfig.OnCalendar = ["0:00:00"];
|
|
};
|
|
};
|
|
}
|