summary refs log tree commit diff stats
path: root/shell.nix
diff options
context:
space:
mode:
authorAlan Pearce2024-04-29 14:48:08 +0200
committerAlan Pearce2024-05-18 12:17:12 +0200
commitec92b62d48052d2e4074b194faee86bf7ad18144 (patch)
tree5c14725810d3ac531d13da9ae18f0df8ba43a485 /shell.nix
parent160dacb051bb3529f33e8d388818f63db810b3a1 (diff)
downloadnixfiles-ec92b62d48052d2e4074b194faee86bf7ad18144.tar.lz
nixfiles-ec92b62d48052d2e4074b194faee86bf7ad18144.tar.zst
nixfiles-ec92b62d48052d2e4074b194faee86bf7ad18144.zip
set up lorri
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix29
1 files changed, 22 insertions, 7 deletions
diff --git a/shell.nix b/shell.nix
index a0eb33c8..9167cb7e 100644
--- a/shell.nix
+++ b/shell.nix
@@ -1,13 +1,30 @@
-let
+with builtins;
 
+let
   sources = import ./nix/sources.nix;
+  sourcesJSON = fromJSON (readFile ./nix/sources.json);
 
   nixpkgs = sources.nixpkgs;
-
   pkgs = import nixpkgs { };
-
+  inherit (pkgs.lib) path attrsets;
+
+  mkPathable = v: toString (
+    if
+      path.subpath.isValid v
+    then
+      path.append ./. v
+    else
+      v
+  );
+
+  nixPath = concatStringsSep ":" (
+    attrsets.mapAttrsToList
+      (k: v: "${k}=${mkPathable (getAttr "outPath" v)}")
+      (intersectAttrs sourcesJSON sources)
+  );
 in
-pkgs.mkShell rec {
+pkgs.mkShell
+{
 
   name = "nixfiles-shell";
 
@@ -19,9 +36,7 @@ pkgs.mkShell rec {
   ];
 
   shellHook = ''
-    export HOST=$(hostname)
-    export NIX_PATH="nixpkgs=${nixpkgs}:home-manager=${sources."home-manager"}:darwin=${sources.nix-darwin}:darwin-config=$PWD/system/$HOST.nix:private=$PWD/private:nixpkgs-overlays=$PWD/overlays:nix-index-database=${sources.nix-index-database}";
-    export HOME_MANAGER_CONFIG="./user/$HOST.nix"
+    export NIX_PATH="${nixPath}";
   '';
 
 }