Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common settings to all configurations #75

Merged
merged 7 commits into from
Oct 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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