nixos-configs/devices/servivi/modules/binary-cache.nix

90 lines
1.9 KiB
Nix
Raw Normal View History

{
config,
mainUser,
pkgs,
...
}: let
# FIXME: make #nixFastChecks an attrset of all, packages, devices and aptDevices
# add binary cache at apartment
inherit (builtins) attrValues;
inherit (config.sops) secrets;
2024-10-28 08:18:00 -04:00
nixFastBuild = pkgs.writeShellApplication {
name = "nixFastBuild";
runtimeInputs = attrValues {
inherit
(pkgs)
gnugrep
nix-fast-build
nix-output-monitor
;
};
2024-10-28 08:18:00 -04:00
text = ''
cd "$FLAKE/results" || return
2024-10-28 08:18:00 -04:00
# Home-assistant sometimes fails some tests when built with everything else
nom build --no-link \
..#nixosConfigurations.homie.config.services.home-assistant.package
nix-fast-build -f ..#nixFastChecks "$@"
2024-10-28 08:18:00 -04:00
'';
};
in {
services.nix-serve = {
enable = true;
secretKeyFile = secrets.binary-cache-key.path;
};
environment.systemPackages = [pkgs.nix-fast-build nixFastBuild];
# Populate cache
systemd = {
services.buildAll = {
serviceConfig = {
Type = "oneshot";
User = mainUser;
Group = config.users.users.${mainUser}.group;
};
path = attrValues {
inherit
(pkgs)
bash
git
nix-fast-build
openssh
;
inherit (config.nix) package;
};
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
git clone https://git.nelim.org/matt1432/nixos-configs.git nix-clone
cd nix-clone
2024-10-28 08:18:00 -04:00
nix-fast-build -f .#nixFastChecks
2024-10-28 08:18:00 -04:00
cd ..
rm -r nix-clone
chore: update flake.lock Flake Inputs: • Updated input 'discord-overlay': 'github:matt1432/discord-nightly-overlay/c103496' (2024-08-08) → 'github:matt1432/discord-nightly-overlay/86c671c' (2024-08-10) • Updated input 'gpu-screen-recorder-src': 'git+https://repo.dec05eba.com/gpu-screen-recorder?ref=refs/heads/master&rev=b9b60ab' (2024-08-09) → 'git+https://repo.dec05eba.com/gpu-screen-recorder?ref=refs/heads/master&rev=01b8cdc' (2024-08-10) • Updated input 'headscale': 'github:juanfont/headscale/948d53f' (2024-08-04) → 'github:juanfont/headscale/fcd1183' (2024-08-11) • Updated input 'home-manager': 'github:nix-community/home-manager/b3d5ea6' (2024-08-07) → 'github:nix-community/home-manager/086f619' (2024-08-11) • Updated input 'hyprgrass': 'github:horriblename/hyprgrass/5c93341' (2024-07-28) → 'github:horriblename/hyprgrass/0bb3b82' (2024-08-11) • Updated input 'jovian': 'github:Jovian-Experiments/Jovian-NixOS/fc3d12d' (2024-08-07) → 'github:Jovian-Experiments/Jovian-NixOS/9117806' (2024-08-11) • Updated input 'nix-gaming': 'github:fufexan/nix-gaming/88aa6c5' (2024-08-04) → 'github:fufexan/nix-gaming/e8ef080' (2024-08-11) • Updated input 'nix-gaming/umu': 'git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix&ref=refs/heads/main&rev=babc721&submodules=1' (2024-08-03) → 'git+https://github.com/Open-Wine-Components/umu-launcher/?dir=packaging/nix&ref=refs/heads/main&rev=74656e9&submodules=1' (2024-08-10) • Updated input 'nix-index-db': 'github:Mic92/nix-index-database/97ca0a0' (2024-08-04) → 'github:Mic92/nix-index-database/ec78079' (2024-08-11) • Updated input 'nixd': 'github:nix-community/nixd/af1255e' (2024-08-06) → 'github:nix-community/nixd/c9d8970' (2024-08-11) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/cb9a96f' (2024-08-04) → 'github:NixOS/nixpkgs/5e0ca22' (2024-08-09) • Updated input 'nixpkgs-wayland': 'github:nix-community/nixpkgs-wayland/e28b410' (2024-08-08) → 'github:nix-community/nixpkgs-wayland/9f566ee' (2024-08-11) • Updated input 'pcsd': 'github:matt1432/nixos-pcsd/f7870c6' (2024-08-06) → 'github:matt1432/nixos-pcsd/7e50677' (2024-08-10) • Updated input 'pr-tracker': 'github:matt1432/pr-tracker/8e93c30' (2024-07-30) → 'github:matt1432/pr-tracker/616ee60' (2024-08-11) • Updated input 'pr-tracker/rust-overlay': 'github:oxalica/rust-overlay/a6fbda5' (2024-07-29) → 'github:oxalica/rust-overlay/615cfd8' (2024-08-10) Docker Images: • codeberg.org/forgejo/forgejo 8.0.1: sha256:f3ec5c63038cf2ce31a71e50e48b24c334ba0a5233808d1a5a60d45203f84f02 → sha256:221639a84fae9d9ec5236a50f4980c3cd5332851949f6e989f5f44cc411cf4fa • postgres 14: sha256:b4d7cd7bd1bc275e8862271531e2180b6c3e9bd92f09e2f53f6c87836183235a → sha256:328bd8cf4b64b81567def9de01a893fb819ab2a94a714a24c9f304995b5645c1 • rssbridge/rss-bridge latest: sha256:2ed2ac1c2308f929947b363d0866aa48543600368f6df4f29a004aa0869d9f22 → sha256:4a7ccb015ded6bcde686a6d6340b5dbad2ec296a6653b42ec91998bb66259272 • ghcr.io/gethomepage/homepage latest: sha256:e23fcd332ecf927fe5c0149142040236b17686916004566c149eef06eb6f8d75 → sha256:e5b2616d17db8961a53c0b7d389d812d31c265d35696d475732f53278c9276f7 • quay.io/vaultwarden/server latest: sha256:4e28425bad4bd13568e1779f682ff7e441eca2ecd079bd77cfcba6e4eaf1b999 → sha256:71668d20d4208d70919cf8cb3caf3071d41ed4b7d95afe71125ccad8408b040d • ghcr.io/wg-easy/wg-easy latest: sha256:4c2c591498aa910ce86a90fa00c4714ffd78dd7556b1f488f226471b97346bc6 → sha256:f6c2587da3fdc9d5927743fb4a92cff42d690b182396ffd0cdad034becb41053 • ghcr.io/linuxserver/radarr latest: sha256:9d6f0548fd805edb30108fdd06d0fc5a4436c9bd708b57bd4119d7aefa815fe4 → sha256:71e29caebf16da4701fc7a6c04d5f34c6b01753549900edf4ecfa585263ea1d4 • ghcr.io/linuxserver/sonarr latest: sha256:f0c1fe322671a5c4a302e27ee7aac622fb3c7ba6da231f6c378fe07ab900d6eb → sha256:bffa87787eacff9023df4400f521c159566d14b5a280caec8b54196071e6038e
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
'';
};
2024-08-13 20:40:55 -04:00
timers.buildAll = {
wantedBy = ["timers.target"];
partOf = ["buildAll.service"];
timerConfig.OnCalendar = ["0:00:00"];
};
};
}