From ec92b62d48052d2e4074b194faee86bf7ad18144 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 29 Apr 2024 14:48:08 +0200 Subject: set up lorri --- shell.nix | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'shell.nix') 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}"; ''; } -- cgit 1.4.1