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: f68c2b5a78aa
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e297aa7b1cf2
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jan 2, 2018

  1. Add hasContext primop

    shlevy committed Jan 2, 2018
    Copy the full SHA
    689b278 View commit details
  2. Merge pull request #1772 from shlevy/hasContext

    Add hasContext primop
    edolstra authored Jan 2, 2018
    Copy the full SHA
    e297aa7 View commit details
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/libexpr/primops.cc
9 changes: 9 additions & 0 deletions src/libexpr/primops.cc
Original file line number Diff line number Diff line change
@@ -1653,6 +1653,14 @@ static void prim_unsafeDiscardStringContext(EvalState & state, const Pos & pos,
}


static void prim_hasContext(EvalState & state, const Pos & pos, Value * * args, Value & v)
{
PathSet context;
state.forceString(*args[0], context, pos);
mkBool(v, !context.empty());
}


/* Sometimes we want to pass a derivation path (i.e. pkg.drvPath) to a
builder without causing the derivation to be built (for instance,
in the derivation that builds NARs in nix-push, when doing
@@ -2083,6 +2091,7 @@ void EvalState::createBaseEnv()
addPrimOp("toString", 1, prim_toString);
addPrimOp("__substring", 3, prim_substring);
addPrimOp("__stringLength", 1, prim_stringLength);
addPrimOp("__hasContext", 1, prim_hasContext);
addPrimOp("__unsafeDiscardStringContext", 1, prim_unsafeDiscardStringContext);
addPrimOp("__unsafeDiscardOutputDependency", 1, prim_unsafeDiscardOutputDependency);
addPrimOp("__hashString", 2, prim_hashString);