mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 09:49:36 +01:00
Make the JSON format for derivation use basename store paths
See #13570 for details --- the idea is that included the store dir in store paths makes systematic JSON parting with e.g. Serde, Aeson, nlohmann, or similiar harder. After talking to Eelco, we are changing the `Derivation` format right away because not only is `nix derivation` technically experimental, we think it is also less widely used in practice than, say, `nix path-info`. Progress on #13570
This commit is contained in:
parent
187520ce88
commit
9d7229a2a4
31 changed files with 275 additions and 140 deletions
|
|
@ -1,4 +1,7 @@
|
|||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "nix/store/store-dir-config.hh"
|
||||
#include "nix/util/json-utils.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
@ -75,3 +78,19 @@ StorePath StorePath::random(std::string_view name)
|
|||
}
|
||||
|
||||
} // namespace nix
|
||||
|
||||
namespace nlohmann {
|
||||
|
||||
using namespace nix;
|
||||
|
||||
StorePath adl_serializer<StorePath>::from_json(const json & json)
|
||||
{
|
||||
return StorePath{getString(json)};
|
||||
}
|
||||
|
||||
void adl_serializer<StorePath>::to_json(json & json, StorePath storePath)
|
||||
{
|
||||
json = storePath.to_string();
|
||||
}
|
||||
|
||||
} // namespace nlohmann
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue