diff options
| author | Michael Hoang <Enzime@users.noreply.github.com> | 2024-03-30 12:48:46 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-30 12:48:46 +1100 |
| commit | 36524adc31566655f2f4d55ad6b875fb5c1a4083 (patch) | |
| tree | b5c62b88da3bc8b7eaea804d7608ee167ad29b9e /modules/system | |
| parent | f0dd0838c3558b59dc3b726d8ab89f5b5e35c297 (diff) | |
| parent | 398510f601cb1a1978a393814514f9ca9fbcfe72 (diff) | |
Merge pull request #915 from malob/add-nix-optimise-module
Add `nix.optimise` module
Diffstat (limited to 'modules/system')
| -rw-r--r-- | modules/system/checks.nix | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/system/checks.nix b/modules/system/checks.nix index 27188e3..5989dc4 100644 --- a/modules/system/checks.nix +++ b/modules/system/checks.nix @@ -191,6 +191,17 @@ let exit 2 fi ''; + + nixStoreOptimiser = '' + if test -O /nix/store; then + echo "[1;31merror: A single-user install can't run optimiser as root, aborting activation[0m" >&2 + echo "Configure the optimiser to run as the current user:" >&2 + echo >&2 + echo " nix.optimiser.user = \"$USER\";" >&2 + echo >&2 + exit 2 + fi + ''; in { @@ -230,6 +241,7 @@ in (mkIf (!config.nix.useDaemon) singleUser) nixStore (mkIf (config.nix.gc.automatic && config.nix.gc.user == null) nixGarbageCollector) + (mkIf (config.nix.optimise.automatic && config.nix.optimise.user == null) nixStoreOptimiser) (mkIf cfg.verifyNixChannels nixChannels) nixInstaller (mkIf cfg.verifyNixPath nixPath) |
