diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2024-09-01 14:22:52 +0200 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2024-09-01 14:22:52 +0200 |
| commit | e19b7362d8deb699aec68009c95fee696743e430 (patch) | |
| tree | 6482e659a003a593037435b154c61bdbb9db8944 /config | |
| parent | 93f448c98cc72b3988fe2b4f1dd41eca4ae1e7e2 (diff) | |
nix: autoupgrade: don't run when a compiler is required
Diffstat (limited to 'config')
| -rw-r--r-- | config/nix.nix | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/config/nix.nix b/config/nix.nix index 920d388..d0b6ba2 100644 --- a/config/nix.nix +++ b/config/nix.nix @@ -1,4 +1,8 @@ -{lib, ...}: { +{ + lib, + pkgs, + ... +}: { personal.nix = { enable = true; autoUpgrade = { @@ -25,5 +29,22 @@ }; startLimitBurst = 1; startLimitIntervalSec = 3600; + preStart = lib.mkAfter '' + echo Dry-building... + drvs=$(${pkgs.nixos-rebuild}/bin/nixos-rebuild dry-build --flake /etc/nixos/ 2>&1 | grep '/nix/store') + for drv in $drvs + do + case $(echo $drv | cut -d'-' -f2) in + gcc | rust | cmake | ghc) + echo Found $drv! + echo Cancelling build: it is likely to be resource-intensive. + echo Here are the derivations that were going to be built, and the paths that were going to be downloaded: + echo $drvs | tr " " "\n" + exit 1 + ;; + esac + done + echo No resource-intensive building detected, good to go! + ''; }; } |
