diff options
| author | Michael Hoang <Enzime@users.noreply.github.com> | 2024-11-08 02:17:27 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-08 02:17:27 +0000 |
| commit | 2fbf4a8417c28cf45bae6e6e97248cbbd9b78632 (patch) | |
| tree | af2c324e718e4ea970d25fd2b7e1bc4562cda93a | |
| parent | 4b3c0d353b1de3ea480718f15a6a97113a168178 (diff) | |
| parent | f0a1269297c8ca7f5aa287166c2a9cfb6e13917c (diff) | |
Merge pull request #1152 from Enzime/push-rvwwkktwykyt
nix: don't allow using `auto-optimise-store` as it can corrupt the store
| -rw-r--r-- | modules/nix/default.nix | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 6bce1e3..d99aae8 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -404,7 +404,7 @@ in { darwin-config = "${config.environment.darwinConfig}"; } "/nix/var/nix/profiles/per-user/root/channels" ]; - + defaultText = lib.literalExpression '' lib.optionals cfg.channel.enable [ # Include default path <darwin-config>. @@ -527,8 +527,10 @@ in description = '' If set to true, Nix automatically detects files in the store that have identical contents, and replaces them with hard links to a single copy. - This saves disk space. If set to false (the default), you can still run - nix-store --optimise to get rid of duplicate files. + This saves disk space. If set to false (the default), you can enable + {option}`nix.optimise.automatic` to run {command}`nix-store --optimise` + periodically to get rid of duplicate files. You can also run + {command}`nix-store --optimise` manually. ''; }; @@ -761,6 +763,13 @@ in { assertion = elem "nixbld" config.users.knownGroups -> elem "nixbld" createdGroups; message = "refusing to delete group nixbld in users.knownGroups, this would break nix"; } { assertion = elem "_nixbld1" config.users.knownGroups -> elem "_nixbld1" createdUsers; message = "refusing to delete user _nixbld1 in users.knownUsers, this would break nix"; } { assertion = config.users.groups ? "nixbld" -> config.users.groups.nixbld.members != []; message = "refusing to remove all members from nixbld group, this would break nix"; } + + { + # Should be fixed in Lix by https://gerrit.lix.systems/c/lix/+/2100 + # As `isNixAtLeast "2.92.0" "2.92.0-devpre20241107" == false`, we need to explicitly check if the user is running Lix 2.92.0 + assertion = cfg.settings.auto-optimise-store -> (cfg.package.pname == "lix" && (isNixAtLeast "2.92.0-devpre20241107" || cfg.package.version == "2.92.0")); + message = "`nix.settings.auto-optimise-store` is known to corrupt the Nix Store, please use `nix.optimise.automatic` instead."; + } ]; # Not in NixOS module |
