Skip to content

Commit

Permalink
Add common settings to NixOS and nix-darwin configurations
Browse files Browse the repository at this point in the history
These are sensible defaults we generally want across all configurations.
  • Loading branch information
srid committed Oct 1, 2024
1 parent 5593460 commit f3156bb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions nix/modules/flake-parts/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ let
}
];
};

# Common and useful setting across all platforms
common = { flake, lib, ... }: {
nix = {
# Enables use of `nix-shell -p ...` etc
nixPath = [ "nixpkgs=${flake.inputs.nixpkgs}" ];
# Make `nix shell` etc use pinned nixpkgs
registry.nixpkgs.flake = flake.inputs.nixpkgs;

settings = {
# Use all CPU cores
max-jobs = lib.mkDefault "auto";
# Duh
experimental-features = lib.mkDefault "nix-command flakes";
# Nullify the registry for purity.
flake-registry = builtins.toFile "empty-flake-registry.json" ''{"flakes":[],"version":2}'';
};
};
};
};

darwinModules = {
Expand Down Expand Up @@ -67,6 +86,7 @@ in
specialArgs = specialArgsFor.nixos;
modules = [
../configurations
nixosModules.common
mod
] ++ lib.optional home-manager nixosModules.home-manager;
};
Expand All @@ -75,6 +95,7 @@ in
specialArgs = specialArgsFor.darwin;
modules = [
../configurations
nixosModules.common
darwinModules.nix-darwin
mod
] ++ lib.optional home-manager darwinModules.home-manager;
Expand Down

0 comments on commit f3156bb

Please sign in to comment.