f34ce41345
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
16 lines
613 B
Nix
16 lines
613 B
Nix
{ lib }:
|
|
let
|
|
inherit (builtins) typeOf;
|
|
in
|
|
rec {
|
|
# This function closely mirrors what this Nix code does:
|
|
# https://github.com/NixOS/nix/blob/2.8.0/src/libexpr/primops.cc#L1102
|
|
# https://github.com/NixOS/nix/blob/2.8.0/src/libexpr/eval.cc#L1981-L2036
|
|
valueToString = value:
|
|
# We can't just use `toString` on all derivation attributes because that
|
|
# would not put path literals in the closure. So we explicitly copy
|
|
# those into the store here
|
|
if typeOf value == "path" then "${value}"
|
|
else if typeOf value == "list" then toString (map valueToString value)
|
|
else toString value;
|
|
}
|