git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #69387 from peterhoeg/f/optimise

nixos/nix-optimise: be smarter about when we run the store optimiser

commit8cc9d24fe1e981b558c68c7cc6a767f9b84ef4df authorPeter Hoeg <peter@hoeg.com> dateThu 26 Sep 2019, 13:10 (7 years ago) parent28a7e8f897834f
2 files changed+3−2
nixos/modules/services/misc/nix-optimise.nix+2−2 nixos/modules/virtualisation/container-config.nix+1
nixos/modules/services/misc/nix-optimise.nix+2−2
@@ -40,8 +40,8 @@ in
4040
4141 systemd.services.nix-optimise =
4242 { description = "Nix Store Optimiser";
43− # No point running it inside a nixos-container. It should be on the host instead.
44− unitConfig.ConditionVirtualization = "!container";
43+ # No point this if the nix daemon (and thus the nix store) is outside
44+ unitConfig.ConditionPathIsReadWrite = "/nix/var/nix/daemon-socket";
4545 serviceConfig.ExecStart = "${config.nix.package}/bin/nix-store --optimise";
4646 startAt = optionals cfg.automatic cfg.dates;
4747 };
nixos/modules/virtualisation/container-config.nix+1
@@ -7,6 +7,7 @@ with lib;
77 config = mkIf config.boot.isContainer {
88
99 # Disable some features that are not useful in a container.
10+ nix.optimise.automatic = mkDefault false; # the store is host managed
1011 services.udisks2.enable = mkDefault false;
1112 powerManagement.enable = mkDefault false;
1213