fix: enable flakes and nix-command and set NIX_PATH for nix-shell

This commit is contained in:
Bernardo Magri
2026-04-13 11:33:07 +01:00
parent ab9700f054
commit f0800e60ca
4 changed files with 32 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
imports = [ imports = [
./options.nix ./options.nix
./state.nix ./state.nix
./nix.nix
./systemd.nix ./systemd.nix
./virtualization.nix ./virtualization.nix
./fonts.nix ./fonts.nix

26
core/system/nix.nix Normal file
View 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;
};
}

View File

@@ -18,7 +18,7 @@ echo "--- Starting Nomarchy Update ---"
# 1. Update Flake Lock # 1. Update Flake Lock
echo "Updating flake inputs..." echo "Updating flake inputs..."
sudo nix --extra-experimental-features "nix-command flakes" flake update --flake "$REPO_DIR" sudo nix flake update --flake "$REPO_DIR"
# 2. Rebuild System # 2. Rebuild System
echo "Applying system-level updates..." echo "Applying system-level updates..."

View File

@@ -5,7 +5,10 @@
# This creates a minimal, text-only installation environment. # This creates a minimal, text-only installation environment.
# No desktop environment - just TTY with gum-based installer. # No desktop environment - just TTY with gum-based installer.
{ imports = [
../core/system/nix.nix
];
# Base installation media configuration is handled by the module imported in flake.nix # Base installation media configuration is handled by the module imported in flake.nix
# Console configuration for a pleasant TTY experience # Console configuration for a pleasant TTY experience