devShellTools.unstructuredDerivationInputEnv: Support older Nix

This commit is contained in:
Robert Hensing
2024-07-28 23:19:58 +02:00
parent 412601690e
commit b3561f17f6
2 changed files with 11 additions and 5 deletions
@@ -31,10 +31,14 @@ rec {
in if lib.elem name (drvAttrs.passAsFile or [])
then
let
nameHash = builtins.convertHash {
hash = "sha256:" + builtins.hashString "sha256" name;
toHashFormat = "nix32";
};
nameHash =
if builtins?convertHash
then builtins.convertHash {
hash = "sha256:" + builtins.hashString "sha256" name;
toHashFormat = "nix32";
}
else
builtins.hashString "sha256" name;
basename = ".attr-${nameHash}";
in
lib.nameValuePair "${name}Path" "${
@@ -149,7 +149,9 @@ lib.recurseIntoAttrs {
diff $exampleBarPathString $barPath
[[ "$(basename $exampleBarPathString)" = "$(basename $barPath)" ]]
${lib.optionalString (builtins?convertHash) ''
[[ "$(basename $exampleBarPathString)" = "$(basename $barPath)" ]]
''}
)
''${args:+fail "args should not be set by Nix. We don't expect it to and unstructuredDerivationInputEnv removes it."}