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)
|
static nlohmann::json storePathSetToJSON(const StorePathSet & paths, Store & store)
|
||||||
{
|
{
|
||||||
auto res = nlohmann::json::array();
|
auto res = nlohmann::json::object();
|
||||||
for (auto & path : paths) {
|
for (auto & path : paths) {
|
||||||
res.push_back(store.printStorePath(path));
|
res[store.printStorePath(path)] = nlohmann::json::object();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,15 @@ rm foobar
|
||||||
nix-store --delete $drvPath
|
nix-store --delete $drvPath
|
||||||
|
|
||||||
drvPathJson=$(nix derivation instantiate --json --no-link --file simple.nix)
|
drvPathJson=$(nix derivation instantiate --json --no-link --file simple.nix)
|
||||||
[ "$drvPathJson" = '["'"$drvPath"'"]' ]
|
[ "$drvPathJson" = '{"'"$drvPath"'":{}}' ]
|
||||||
nix-store --delete $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=(./multidrv*)
|
||||||
[ "${#roots[@]}" -gt 1 ]
|
[ "${#roots[@]}" -gt 1 ]
|
||||||
[ "${#roots[@]}" -eq "${#drvPaths[@]}" ]
|
[ "${#roots[@]}" -eq "${#drvPaths[@]}" ]
|
||||||
rootedPaths=($(readlink "${roots[@]}"))
|
rootedPaths=($(readlink "${roots[@]}"))
|
||||||
[ "${rootedPaths[*]}" = "${drvPaths[*]}" ]
|
[ "${rootedPaths[*]}" = "${drvPaths[*]}" ]
|
||||||
|
rm multidrv*
|
||||||
|
|
||||||
nix-collect-garbage
|
nix-collect-garbage
|
||||||
|
|
Loading…
Reference in a new issue