Merge pull request #6308 from NixOS/consisten-use-of-url-uri-5872

Fix flake profile use of originalUrl vs. originalUri
This commit is contained in:
Eelco Dolstra 2022-03-24 14:02:33 +01:00 committed by GitHub
commit 97734fea1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -107,8 +107,9 @@ struct ProfileManifest
element.storePaths.insert(state.store->parseStorePath((std::string) p)); element.storePaths.insert(state.store->parseStorePath((std::string) p));
element.active = e["active"]; element.active = e["active"];
if (e.value("uri", "") != "") { if (e.value("uri", "") != "") {
auto originalUrl = e.value("originalUrl", e["originalUri"]);
element.source = ProfileElementSource{ element.source = ProfileElementSource{
parseFlakeRef(e["originalUri"]), parseFlakeRef(originalUrl),
parseFlakeRef(e["uri"]), parseFlakeRef(e["uri"]),
e["attrPath"] e["attrPath"]
}; };
@ -143,7 +144,7 @@ struct ProfileManifest
obj["storePaths"] = paths; obj["storePaths"] = paths;
obj["active"] = element.active; obj["active"] = element.active;
if (element.source) { if (element.source) {
obj["originalUri"] = element.source->originalRef.to_string(); obj["originalUrl"] = element.source->originalRef.to_string();
obj["uri"] = element.source->resolvedRef.to_string(); obj["uri"] = element.source->resolvedRef.to_string();
obj["attrPath"] = element.source->attrPath; obj["attrPath"] = element.source->attrPath;
} }

View file

@ -70,7 +70,7 @@ are installed in this version of the profile. It looks like this:
{ {
"active": true, "active": true,
"attrPath": "legacyPackages.x86_64-linux.zoom-us", "attrPath": "legacyPackages.x86_64-linux.zoom-us",
"originalUri": "flake:nixpkgs", "originalUrl": "flake:nixpkgs",
"storePaths": [ "storePaths": [
"/nix/store/wbhg2ga8f3h87s9h5k0slxk0m81m4cxl-zoom-us-5.3.469451.0927" "/nix/store/wbhg2ga8f3h87s9h5k0slxk0m81m4cxl-zoom-us-5.3.469451.0927"
], ],
@ -84,11 +84,11 @@ are installed in this version of the profile. It looks like this:
Each object in the array `elements` denotes an installed package and Each object in the array `elements` denotes an installed package and
has the following fields: has the following fields:
* `originalUri`: The [flake reference](./nix3-flake.md) specified by * `originalUrl`: The [flake reference](./nix3-flake.md) specified by
the user at the time of installation (e.g. `nixpkgs`). This is also the user at the time of installation (e.g. `nixpkgs`). This is also
the flake reference that will be used by `nix profile upgrade`. the flake reference that will be used by `nix profile upgrade`.
* `uri`: The immutable flake reference to which `originalUri` * `uri`: The immutable flake reference to which `originalUrl`
resolved. resolved.
* `attrPath`: The flake output attribute that provided this * `attrPath`: The flake output attribute that provided this