1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

Allow access to the result of fetchClosure

This commit is contained in:
Eelco Dolstra 2025-10-23 19:18:57 +02:00
parent 324bfd82dc
commit 7308fde0bc
3 changed files with 16 additions and 0 deletions

View file

@ -64,6 +64,8 @@ static void runFetchClosureWithRewrite(
.pos = state.positions[pos]}); .pos = state.positions[pos]});
} }
state.allowClosure(toPath);
state.mkStorePathString(toPath, v); state.mkStorePathString(toPath, v);
} }
@ -91,6 +93,8 @@ static void runFetchClosureWithContentAddressedPath(
.pos = state.positions[pos]}); .pos = state.positions[pos]});
} }
state.allowClosure(fromPath);
state.mkStorePathString(fromPath, v); state.mkStorePathString(fromPath, v);
} }
@ -115,6 +119,8 @@ static void runFetchClosureWithInputAddressedPath(
.pos = state.positions[pos]}); .pos = state.positions[pos]});
} }
state.allowClosure(fromPath);
state.mkStorePathString(fromPath, v); state.mkStorePathString(fromPath, v);
} }

View file

@ -17,4 +17,6 @@ ln -s "$out" "$out"/self
echo program > "$out"/program echo program > "$out"/program
chmod +x "$out"/program chmod +x "$out"/program
echo '1 + 2' > "$out"/foo.nix
echo FOO echo FOO

View file

@ -99,6 +99,14 @@ clearStore
[ -e "$caPath" ] [ -e "$caPath" ]
# Test import-from-derivation on the result of fetchClosure.
[[ $(nix eval -v --expr "
import \"\${builtins.fetchClosure {
fromStore = \"file://$cacheDir\";
fromPath = $caPath;
}}/foo.nix\"
") = 3 ]]
# Check that URL query parameters aren't allowed. # Check that URL query parameters aren't allowed.
clearStore clearStore
narCache=$TEST_ROOT/nar-cache narCache=$TEST_ROOT/nar-cache