mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Switch nix-derivation-instantiate json output to obect keys instead of list
This commit is contained in:
parent
d22a2fe517
commit
7e83ab3e35
|
@ -11,9 +11,9 @@ using namespace nix;
|
|||
|
||||
static nlohmann::json storePathSetToJSON(const StorePathSet & paths, Store & store)
|
||||
{
|
||||
auto res = nlohmann::json::array();
|
||||
auto res = nlohmann::json::object();
|
||||
for (auto & path : paths) {
|
||||
res.push_back(store.printStorePath(path));
|
||||
res[store.printStorePath(path)] = nlohmann::json::object();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -30,14 +30,15 @@ rm foobar
|
|||
nix-store --delete $drvPath
|
||||
|
||||
drvPathJson=$(nix derivation instantiate --json --no-link --file simple.nix)
|
||||
[ "$drvPathJson" = '["'"$drvPath"'"]' ]
|
||||
[ "$drvPathJson" = '{"'"$drvPath"'":{}}' ]
|
||||
nix-store --delete $drvPath
|
||||
|
||||
drvPaths=($(nix derivation instantiate --json --out-link multidrv --file check.nix | jq '.[]' -r))
|
||||
drvPaths=($(nix derivation instantiate --json --out-link multidrv --file check.nix | jq 'keys|.[]' -r))
|
||||
roots=(./multidrv*)
|
||||
[ "${#roots[@]}" -gt 1 ]
|
||||
[ "${#roots[@]}" -eq "${#drvPaths[@]}" ]
|
||||
rootedPaths=($(readlink "${roots[@]}"))
|
||||
[ "${rootedPaths[*]}" = "${drvPaths[*]}" ]
|
||||
rm multidrv*
|
||||
|
||||
nix-collect-garbage
|
||||
|
|
Loading…
Reference in a new issue