Skip to content

Commit

Permalink
refactor: make nix configuration in nix-darwin the same as NixOS
Browse files Browse the repository at this point in the history
  • Loading branch information
flexiondotorg committed Dec 7, 2024
1 parent 0e4cb71 commit ba034ac
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ba034ac

Please sign in to comment.