From e0e3c36d1b7272ec50da93501de5a1298c1d6b7e Mon Sep 17 00:00:00 2001 From: Colin Date: Tue, 6 Jun 2023 07:49:52 +0000 Subject: [PATCH] fix NIX_PATH overlay interaction that was crashing nix-shell --- hosts/common/default.nix | 6 +----- hosts/common/nix-path/default.nix | 10 ++++++++++ hosts/common/nix-path/overlay/default.nix | 4 ++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 hosts/common/nix-path/default.nix create mode 100644 hosts/common/nix-path/overlay/default.nix diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 5b1a200b..81b867ea 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -8,6 +8,7 @@ ./ids.nix ./machine-id.nix ./net.nix + ./nix-path ./persist.nix ./programs ./secrets.nix @@ -36,11 +37,6 @@ nix.extraOptions = '' experimental-features = nix-command flakes ''; - # allow `nix-shell` (and probably nix-index?) to locate our patched and custom packages - nix.nixPath = [ - "nixpkgs=${pkgs.path}" - "nixpkgs-overlays=${../..}/overlays" - ]; # hardlinks identical files in the nix store to save 25-35% disk space. # unclear _when_ this occurs. it's not a service. # does the daemon continually scan the nix store? diff --git a/hosts/common/nix-path/default.nix b/hosts/common/nix-path/default.nix new file mode 100644 index 00000000..329c0049 --- /dev/null +++ b/hosts/common/nix-path/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + # allow `nix-shell` (and probably nix-index?) to locate our patched and custom packages + nix.nixPath = [ + "nixpkgs=${pkgs.path}" + # note the import starts at repo root: this allows `./overlay/default.nix` to access the stuff at the root + "nixpkgs-overlays=${../../..}/hosts/common/nix-path/overlay" + ]; +} diff --git a/hosts/common/nix-path/overlay/default.nix b/hosts/common/nix-path/overlay/default.nix new file mode 100644 index 00000000..b0c5b22a --- /dev/null +++ b/hosts/common/nix-path/overlay/default.nix @@ -0,0 +1,4 @@ +# XXX: NIX_PATH=...:nixpkgs-overlays=... will import every overlay in the directory +# so we prefer to give it a directory with just this *one* overlay, otherwise it imports conflicting overlays +# and gets stuck in a loop until it OOMs +import ../../../../overlays/all.nix