diff --git a/darwin/default.nix b/darwin/default.nix index 4841aff9..2ace200c 100644 --- a/darwin/default.nix +++ b/darwin/default.nix @@ -65,17 +65,29 @@ ]; }; - nix = { - optimise.automatic = true; - settings = { - auto-optimise-store = true; - experimental-features = [ - "nix-command" - "flakes" - ]; - warn-dirty = false; + nix = + let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in + { + settings = { + experimental-features = "flakes nix-command"; + # Disable global registry + flake-registry = ""; + # Workaround for https://github.com/NixOS/nix/issues/9574 + nix-path = config.nix.nixPath; + trusted-users = [ + "root" + "${username}" + ]; + warn-dirty = false; + }; + # Disable channels + channel.enable = false; + # Make flake registry and nix path match flake inputs + registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; }; - }; networking.hostName = hostname; networking.computerName = hostname;