fix: enable flakes and nix-command and set NIX_PATH for nix-shell
This commit is contained in:
26
core/system/nix.nix
Normal file
26
core/system/nix.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ inputs, lib, ... }:
|
||||
|
||||
{
|
||||
nix = {
|
||||
settings = {
|
||||
# Enable experimental features for modern Nix commands and flakes
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Allow users in the wheel group to manage the Nix store
|
||||
trusted-users = [ "root" "@wheel" ];
|
||||
|
||||
# Optimize storage by hard-linking identical files
|
||||
auto-optimise-store = lib.mkDefault true;
|
||||
};
|
||||
|
||||
# Populates NIX_PATH with the nixpkgs input from the flake.
|
||||
# This is critical for making 'nix-shell -p ...' and other legacy
|
||||
# Nix commands work in a flake-based environment without channels.
|
||||
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
||||
|
||||
# Map all flake inputs to the system registry.
|
||||
# This ensures 'nix shell nixpkgs#...' uses the exact same version
|
||||
# as the rest of the system and doesn't need to re-download.
|
||||
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user