diff --git a/modules/common/default.nix b/modules/common/default.nix index 24081ac..3393144 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -113,38 +113,6 @@ config = let stateVersion = "23.05"; in { - nix = { - - # Enable features in Nix commands - extraOptions = '' - experimental-features = nix-command flakes - warn-dirty = false - ''; - - gc = { - automatic = true; - options = "--delete-older-than 10d"; - }; - - settings = { - - # Add community Cachix to binary cache - # Don't use with macOS because blocked by corporate firewall - builders-use-substitutes = true; - substituters = lib.mkIf (!pkgs.stdenv.isDarwin) - [ "https://nix-community.cachix.org" ]; - trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - - # Scans and hard links identical files in the store - # Not working with macOS: https://github.com/NixOS/nix/issues/7273 - auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true; - - }; - - }; - # Basic common system packages for all devices environment.systemPackages = with pkgs; [ git vim wget curl ]; diff --git a/modules/common/shell/nixpkgs.nix b/modules/common/shell/nixpkgs.nix index 5345773..5e10602 100644 --- a/modules/common/shell/nixpkgs.nix +++ b/modules/common/shell/nixpkgs.nix @@ -72,6 +72,12 @@ fi ''); + # Set automatic generation cleanup for home-manager + nix.gc = { + automatic = config.nix.gc.automatic; + options = config.nix.gc.options; + }; + }; nix = { @@ -88,6 +94,34 @@ # For security, only allow specific users settings.allowed-users = [ "@wheel" config.user ]; + # Enable features in Nix commands + extraOptions = '' + experimental-features = nix-command flakes + warn-dirty = false + ''; + + gc = { + automatic = true; + options = "--delete-older-than 10d"; + }; + + settings = { + + # Add community Cachix to binary cache + # Don't use with macOS because blocked by corporate firewall + builders-use-substitutes = true; + substituters = + lib.mkIf (!pkgs.stdenv.isDarwin) [ "https://nix-community.cachix.org" ]; + trusted-public-keys = lib.mkIf (!pkgs.stdenv.isDarwin) [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + + # Scans and hard links identical files in the store + # Not working with macOS: https://github.com/NixOS/nix/issues/7273 + auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true; + + }; + }; }