nixos-configs/devices/servivi/modules/binary-cache.nix
matt1432 ed92a42266
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: make sshd module and some code refactor
2023-12-27 11:39:38 -05:00

46 lines
867 B
Nix

{
config,
pkgs,
...
}: let
secrets = config.sops.secrets;
vars = config.vars;
in {
services.nix-serve = {
enable = true;
secretKeyFile = secrets.binary-cache-key.path;
};
# Populate cache
systemd = {
services.buildAll = {
serviceConfig = {
Type = "oneshot";
User = vars.user;
Group = config.users.users.${vars.user}.group;
};
path = with pkgs; [
git
nix
nixci
openssh
];
script = ''
cd /tmp
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"];
};
};
}