From 0f630c8671acd1b0c3a441e83fd49e3d84783439 Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Tue, 25 Feb 2025 22:29:26 -0500 Subject: nixos/nix: get NIX_PATH from system derivation --- modules/nixos/defaults/nix.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'modules/nixos') diff --git a/modules/nixos/defaults/nix.nix b/modules/nixos/defaults/nix.nix index e55faf4..fba0efc 100644 --- a/modules/nixos/defaults/nix.nix +++ b/modules/nixos/defaults/nix.nix @@ -1,12 +1,32 @@ -{ lib, ... }: +{ + lib, + pkgs, + inputs, + ... +}: + +let + flakeInputs = pkgs.linkFarm "flake-inputs" ( + lib.mapAttrs (lib.const (flake: flake.outPath)) inputs + ); +in + { nix = { channel.enable = lib.mkDefault false; + + nixPath = lib.mkForce ( + lib.mapAttrsToList (name: lib.const "${name}=/run/current-system/inputs/${name}") inputs + ); + settings.trusted-users = [ - "root" "@wheel" ]; }; nixpkgs.config.allowAliases = false; + + system.extraSystemBuilderCmds = '' + ln -s ${flakeInputs} $out/inputs + ''; } -- cgit v1.2.3