Merge pull request #79 from aloiscochard/feature/fix-path

Properly differentiate between derivation and store path.
This commit is contained in:
Matthew Bauer 2021-07-19 09:28:37 -05:00 committed by GitHub
commit 223f4ffc41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,10 +11,11 @@ let
}); });
in rec { in rec {
toStorePath = target: toStorePath = target:
# If a store path has been given but is a string, add the missing context # If a store path has been given but is not a derivation, add the missing context
# to it so it will be propagated properly as a build input. # to it so it will be propagated properly as a build input.
if builtins.isString target && lib.isStorePath target then if !(lib.isDerivation target) && lib.isStorePath target then
builtins.appendContext target { "${target}" = { path = true; }; } let path = toString target; in
builtins.appendContext path { "${path}" = { path = true; }; }
# Otherwise, add to the store. This takes care of appending the store path # Otherwise, add to the store. This takes care of appending the store path
# in the context automatically. # in the context automatically.
else "${target}"; else "${target}";