NixOS system configurations + dotfiles via home-manager

automatically update flake.nix on a branch

+51
+51
modules/flake/update.nix
··· 1 + { 2 + flake.modules.hjem.grancel = 3 + { pkgs, ... }: 4 + { 5 + systemd = { 6 + services.update-flake.path = with pkgs; [ 7 + lix 8 + jujutsu 9 + git 10 + openssh 11 + ]; 12 + services.update-flake.serviceConfig = { 13 + Type = "oneshot"; 14 + ExecStart = pkgs.writers.writeFish "update-flake" '' 15 + test -d /etc/nixos; or exit 0 16 + cd /etc/nixos 17 + jj root; or exit 0 18 + 19 + jj new --quiet 20 + set restore (jj log --no-graph -r @- -T 'change_id.shortest(8)') 21 + echo Will restore $restore 22 + 23 + set remote github 24 + echo Fetching remote $remote 25 + jj git fetch --remote $remote 26 + jj new main@$remote 27 + 28 + echo Starting flake update 29 + git config set --local user.name 'Peter Rice (automated)' 30 + git config set --local user.email noreply@pvsr.dev 31 + nix flake update --commit-lock-file 32 + git config unset --local user.name 33 + git config unset --local user.email 34 + 35 + set bookmark flake-update 36 + jj bookmark set -B -r "@- ~ main@$remote" $bookmark 37 + and jj git push --remote $remote --bookmark $bookmark 38 + 39 + jj edit $restore 40 + ''; 41 + }; 42 + timers.update-flake = { 43 + timerConfig = { 44 + OnCalendar = "Fri *-*-* 06:00"; 45 + Persistent = true; 46 + }; 47 + wantedBy = [ "timers.target" ]; 48 + }; 49 + }; 50 + }; 51 + }