Merge pull request #119406 from sternenseemann/toDerivation-list

lib/attrsets: make toDerivation x always work when isStorePath x
This commit is contained in:
Silvan Mosberger 2021-05-07 02:09:05 +02:00 committed by GitHub
commit 527861959b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -659,7 +659,7 @@ rec {
Example:
isStorePath "/nix/store/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11/bin/python"
=> false
isStorePath "/nix/store/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11/"
isStorePath "/nix/store/d945ibfx9x185xf04b890y4f9g3cbb63-python-2.7.11"
=> true
isStorePath pkgs.python
=> true
@ -667,7 +667,7 @@ rec {
=> false
*/
isStorePath = x:
if isCoercibleToString x then
if !(isList x) && isCoercibleToString x then
let str = toString x; in
substring 0 1 str == "/"
&& dirOf str == storeDir