2023-12-26 00:48:43 -05:00
|
|
|
{
|
|
|
|
config,
|
2024-11-22 23:15:13 -05:00
|
|
|
mainUser,
|
2023-12-26 00:48:43 -05:00
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-12-11 11:42:40 -05:00
|
|
|
inherit (builtins) attrValues;
|
2024-01-09 13:13:04 -05:00
|
|
|
inherit (config.sops) secrets;
|
2024-04-22 13:51:31 -04:00
|
|
|
|
2024-10-28 08:18:00 -04:00
|
|
|
nixFastBuild = pkgs.writeShellApplication {
|
|
|
|
name = "nixFastBuild";
|
2024-12-05 13:06:45 -05:00
|
|
|
|
2024-12-11 11:42:40 -05:00
|
|
|
runtimeInputs = attrValues {
|
2024-12-05 13:06:45 -05:00
|
|
|
inherit
|
|
|
|
(pkgs)
|
|
|
|
gnugrep
|
2024-12-11 11:42:40 -05:00
|
|
|
nix-fast-build
|
2024-12-05 13:06:45 -05:00
|
|
|
nix-output-monitor
|
|
|
|
;
|
|
|
|
};
|
|
|
|
|
2024-10-28 08:18:00 -04:00
|
|
|
text = ''
|
2024-12-11 08:30:13 -05:00
|
|
|
cd "$FLAKE/results" || return
|
2024-10-28 08:18:00 -04:00
|
|
|
|
2024-12-05 13:06:45 -05:00
|
|
|
# Home-assistant sometimes fails some tests when built with everything else
|
|
|
|
nom build --no-link \
|
2024-12-11 08:30:13 -05:00
|
|
|
..#nixosConfigurations.homie.config.services.home-assistant.package
|
2024-12-05 13:06:45 -05:00
|
|
|
|
2024-12-16 15:51:41 -05:00
|
|
|
nix-fast-build -f ..#nixFastChecks.all "$@"
|
2024-10-28 08:18:00 -04:00
|
|
|
'';
|
|
|
|
};
|
2023-12-26 00:48:43 -05:00
|
|
|
in {
|
|
|
|
services.nix-serve = {
|
|
|
|
enable = true;
|
|
|
|
secretKeyFile = secrets.binary-cache-key.path;
|
|
|
|
};
|
|
|
|
|
2024-12-11 11:42:40 -05:00
|
|
|
environment.systemPackages = [pkgs.nix-fast-build nixFastBuild];
|
2024-08-05 16:40:32 -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-12-11 11:42:40 -05:00
|
|
|
path = attrValues {
|
2024-12-05 13:06:45 -05:00
|
|
|
inherit
|
|
|
|
(pkgs)
|
|
|
|
bash
|
|
|
|
git
|
2024-12-11 11:42:40 -05:00
|
|
|
nix-fast-build
|
2024-12-05 13:06:45 -05:00
|
|
|
openssh
|
|
|
|
;
|
|
|
|
|
|
|
|
inherit (config.nix) package;
|
|
|
|
};
|
2023-12-27 11:39:38 -05:00
|
|
|
|
2023-12-26 00:48:43 -05:00
|
|
|
script = ''
|
|
|
|
cd /tmp
|
2024-10-28 08:18:00 -04:00
|
|
|
|
2024-01-30 14:56:47 -05:00
|
|
|
if [[ -d ./nix-clone ]]; then
|
|
|
|
rm -r ./nix-clone
|
|
|
|
fi
|
2024-10-28 08:18:00 -04:00
|
|
|
|
2023-12-27 11:39:38 -05:00
|
|
|
git clone https://git.nelim.org/matt1432/nixos-configs.git nix-clone
|
|
|
|
cd nix-clone
|
2024-10-28 08:18:00 -04:00
|
|
|
|
2024-12-16 15:51:41 -05:00
|
|
|
nix-fast-build -f .#nixFastChecks.all
|
2024-10-28 08:18:00 -04:00
|
|
|
|
2023-12-27 11:39:38 -05:00
|
|
|
cd ..
|
|
|
|
rm -r nix-clone
|
2024-08-11 19:47:45 -04:00
|
|
|
|
2024-08-13 20:40:55 -04:00
|
|
|
# Just to cache mozilla-addons-to-nix
|
|
|
|
nix run sourcehut:~rycee/mozilla-addons-to-nix -- --help
|
2023-12-26 00:48:43 -05:00
|
|
|
'';
|
|
|
|
};
|
2024-08-13 20:40:55 -04:00
|
|
|
|
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
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|