From f0800e60ca4f3ce20d5405a727589144393a678c Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Mon, 13 Apr 2026 11:33:07 +0100 Subject: [PATCH] fix: enable flakes and nix-command and set NIX_PATH for nix-shell --- core/system/default.nix | 1 + core/system/nix.nix | 26 ++++++++++++++++++++++++++ core/system/scripts/nomarchy-update | 2 +- hosts/installer-iso.nix | 5 ++++- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 core/system/nix.nix diff --git a/core/system/default.nix b/core/system/default.nix index 868694f..679f5ac 100644 --- a/core/system/default.nix +++ b/core/system/default.nix @@ -4,6 +4,7 @@ imports = [ ./options.nix ./state.nix + ./nix.nix ./systemd.nix ./virtualization.nix ./fonts.nix diff --git a/core/system/nix.nix b/core/system/nix.nix new file mode 100644 index 0000000..3855ba0 --- /dev/null +++ b/core/system/nix.nix @@ -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; + }; +} diff --git a/core/system/scripts/nomarchy-update b/core/system/scripts/nomarchy-update index 81e7e55..5fd6074 100755 --- a/core/system/scripts/nomarchy-update +++ b/core/system/scripts/nomarchy-update @@ -18,7 +18,7 @@ echo "--- Starting Nomarchy Update ---" # 1. Update Flake Lock 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 echo "Applying system-level updates..." diff --git a/hosts/installer-iso.nix b/hosts/installer-iso.nix index a4bad7b..21449e1 100644 --- a/hosts/installer-iso.nix +++ b/hosts/installer-iso.nix @@ -5,7 +5,10 @@ # This creates a minimal, text-only installation environment. # 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 # Console configuration for a pleasant TTY experience