@@ -61,6 +61,7 @@ prefsUpdate = let
6161 spackConfig = lib . recursiveUpdate ;
6262 spackPython = scalar ;
6363 spackPath = scalar ;
64+ spackEnv = lib . recursiveUpdate ;
6465 nixpkgsSrc = scalar ;
6566 nixpkgs = scalar ;
6667 verbose = scalar ;
@@ -81,6 +82,7 @@ packsWithPrefs =
8182 , spackConfig ? { }
8283 , spackPython ? "/usr/bin/python3"
8384 , spackPath ? "/bin:/usr/bin"
85+ , spackEnv ? { PATH = spackPath ; }
8486 , nixpkgsSrc ? null
8587 , nixpkgs ? fetchGit ( {
8688 url = "git://github.com/NixOS/nixpkgs" ;
@@ -102,33 +104,31 @@ lib.fix (packs: with packs; {
102104 ( { label = "withPrefs" ; } // p ) ) ;
103105
104106
105- makeSpackConfig = import ../spack/config.nix packs spackPath ;
107+ makeSpackConfig = import ../spack/config.nix packs spackEnv ;
106108
107- inherit spack spackPython spackPath ;
109+ inherit spack spackPython spackEnv ;
108110 spackConfig = makeSpackConfig ( lib . recursiveUpdate defaultSpackConfig packPrefs . spackConfig ) ;
109111
110- spackNixLib = derivation {
112+ spackNixLib = derivation ( {
111113 name = "nix-spack-py" ;
112114 inherit system ;
113115 builder = ../spack/install.sh ;
114116 src = ../spack/nixpack.py ;
115- PATH = spackPath ;
116- } ;
117+ } // spackEnv ) ;
117118
118119 /* common attributes for running spack */
119120 spackBuilder = attrs : builtins . removeAttrs ( derivation ( {
120121 inherit ( packs ) system os spackConfig ;
121122 builder = spackPython ;
122123 PYTHONPATH = "${ spackNixLib } :${ spack } /lib/spack:${ spack } /lib/spack/external" ;
123- PATH = spackPath ;
124124 LC_ALL = "en_US.UTF-8" ; # work around spack bugs processing log files
125125 repos = if attrs ? withRepos
126126 then if attrs . withRepos
127127 then repos
128128 else null
129129 else map ( r : r + "/repo.yaml" ) repos ;
130130 spackCache = if attrs . withRepos or false then spackCacheRepos else spackCache ;
131- } // attrs ) ) [ "PYTHONPATH" "PATH" "LC_ALL" "spackConfig" "spackCache" "passAsFile" ] ;
131+ } // spackEnv // attrs ) ) [ "PYTHONPATH" "PATH" "LC_ALL" "spackConfig" "spackCache" "passAsFile" ] ;
132132
133133 /* pre-generated spack repo index cache (both with and without overlay repos) */
134134 makeSpackCache = withRepos : lib . when ( builtins . isAttrs spackSrc )
0 commit comments