From e4f1cfb53f4aa15e08e1fb048d31d5633bfb806f Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 12 Dec 2023 02:13:59 +0000 Subject: [PATCH] servo: deploy a service which periodically rebuilds my nix config to populate the cache --- hosts/by-name/servo/services/default.nix | 1 + .../by-name/servo/services/nixos-prebuild.nix | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 hosts/by-name/servo/services/nixos-prebuild.nix diff --git a/hosts/by-name/servo/services/default.nix b/hosts/by-name/servo/services/default.nix index 5828c84a4..2df3de3a7 100644 --- a/hosts/by-name/servo/services/default.nix +++ b/hosts/by-name/servo/services/default.nix @@ -22,6 +22,7 @@ ./monero.nix ./navidrome.nix ./nginx.nix + ./nixos-prebuild.nix ./nixserve.nix ./ntfy ./pict-rs.nix diff --git a/hosts/by-name/servo/services/nixos-prebuild.nix b/hosts/by-name/servo/services/nixos-prebuild.nix new file mode 100644 index 000000000..4a16ac98a --- /dev/null +++ b/hosts/by-name/servo/services/nixos-prebuild.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +{ + systemd.services.nixos-prebuild = { + description = "build a nixos image with all updated deps"; + path = with pkgs; [ coreutils git nix ]; + script = '' + working=$(mktemp -d /tmp/nixos-prebuild.XXXXXX) + pushd "$working" + git clone https://git.uninsane.org/colin/nix-files.git + cd nix-files + nix flake update + nix run '.#check' -- -j1 --cores 5 + popd + rm -rf "$working" + ''; + }; + + systemd.timers.nixos-prebuild = { + wantedBy = [ "multi-user.target" ]; + timerConfig.OnCalendar = "11,23:00:00"; + }; +}