Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 74024515a306
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 021634e3e3ed
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Apr 2, 2020

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    ed13457 View commit details
  2. nix-env: Refuse to operate on a new-style profile

    This prevents users from accidentally nuking their profile via
    nix-env.
    edolstra committed Apr 2, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    NeQuissimus Tim Steinbach
    Copy the full SHA
    021634e View commit details
Showing with 9 additions and 19 deletions.
  1. +1 −13 src/libexpr/flake/lockfile.cc
  2. +0 −6 src/libfetchers/fetchers.cc
  3. +5 −0 src/libfetchers/tree-info.hh
  4. +2 −0 src/nix-env/user-env.cc
  5. +1 −0 src/nix/flake.cc
14 changes: 1 addition & 13 deletions src/libexpr/flake/lockfile.cc
Original file line number Diff line number Diff line change
@@ -76,18 +76,6 @@ LockedNode::LockedNode(const nlohmann::json & json)
throw Error("lockfile contains mutable flakeref '%s'", lockedRef);
}

static nlohmann::json treeInfoToJson(const TreeInfo & info)
{
nlohmann::json json;
assert(info.narHash);
json["narHash"] = info.narHash.to_string(SRI);
if (info.revCount)
json["revCount"] = *info.revCount;
if (info.lastModified)
json["lastModified"] = *info.lastModified;
return json;
}

StorePath LockedNode::computeStorePath(Store & store) const
{
return info.computeStorePath(store);
@@ -193,7 +181,7 @@ nlohmann::json LockFile::toJson() const
if (auto lockedNode = std::dynamic_pointer_cast<const LockedNode>(node)) {
n["original"] = fetchers::attrsToJson(lockedNode->originalRef.toAttrs());
n["locked"] = fetchers::attrsToJson(lockedNode->lockedRef.toAttrs());
n["info"] = treeInfoToJson(lockedNode->info);
n["info"] = lockedNode->info.toJson();
if (!lockedNode->isFlake) n["flake"] = false;
}

6 changes: 0 additions & 6 deletions src/libfetchers/fetchers.cc
Original file line number Diff line number Diff line change
@@ -81,10 +81,4 @@ std::shared_ptr<const Input> Input::applyOverrides(
return shared_from_this();
}

StorePath TreeInfo::computeStorePath(Store & store) const
{
assert(narHash);
return store.makeFixedOutputPath(true, narHash, "source");
}

}
5 changes: 5 additions & 0 deletions src/libfetchers/tree-info.hh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#pragma once

#include "path.hh"
#include "hash.hh"

#include <nlohmann/json_fwd.hpp>

namespace nix { class Store; }

@@ -21,6 +24,8 @@ struct TreeInfo
}

StorePath computeStorePath(Store & store) const;

nlohmann::json toJson() const;
};

}
2 changes: 2 additions & 0 deletions src/nix-env/user-env.cc
Original file line number Diff line number Diff line change
@@ -15,6 +15,8 @@ namespace nix {
DrvInfos queryInstalled(EvalState & state, const Path & userEnv)
{
DrvInfos elems;
if (pathExists(userEnv + "/manifest.json"))
throw Error("profile '%s' is incompatible with 'nix-env'; please use 'nix profile' instead", userEnv);
Path manifestFile = userEnv + "/manifest.nix";
if (pathExists(manifestFile)) {
Value v;
1 change: 1 addition & 0 deletions src/nix/flake.cc
Original file line number Diff line number Diff line change
@@ -103,6 +103,7 @@ static nlohmann::json flakeToJson(const Store & store, const Flake & flake)
j["url"] = flake.lockedRef.to_string();
j["original"] = attrsToJson(flake.originalRef.toAttrs());
j["locked"] = attrsToJson(flake.lockedRef.toAttrs());
j["info"] = flake.sourceInfo->info.toJson();
if (auto rev = flake.lockedRef.input->getRev())
j["revision"] = rev->to_string(Base16, false);
if (flake.sourceInfo->info.revCount)