mirror of
https://github.com/NixOS/nix
synced 2025-06-25 19:01:16 +02:00
Actually ignore system/user registries during locking
Something went wrong in #12068 so this didn't work. Also added a test.
(cherry picked from commit 77d4316353
)
This commit is contained in:
parent
c548e92860
commit
a08477975d
2 changed files with 8 additions and 1 deletions
|
@ -39,7 +39,7 @@ FlakeRef FlakeRef::resolve(
|
||||||
ref<Store> store,
|
ref<Store> store,
|
||||||
const fetchers::RegistryFilter & filter) const
|
const fetchers::RegistryFilter & filter) const
|
||||||
{
|
{
|
||||||
auto [input2, extraAttrs] = lookupInRegistries(store, input);
|
auto [input2, extraAttrs] = lookupInRegistries(store, input, filter);
|
||||||
return FlakeRef(std::move(input2), fetchers::maybeGetStrAttr(extraAttrs, "dir").value_or(subdir));
|
return FlakeRef(std::move(input2), fetchers::maybeGetStrAttr(extraAttrs, "dir").value_or(subdir));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,13 @@ nix store gc
|
||||||
nix registry list --flake-registry "file://$registry" --refresh | grepQuiet flake3
|
nix registry list --flake-registry "file://$registry" --refresh | grepQuiet flake3
|
||||||
mv "$registry.tmp" "$registry"
|
mv "$registry.tmp" "$registry"
|
||||||
|
|
||||||
|
# Ensure that locking ignores the user registry.
|
||||||
|
mkdir -p "$TEST_HOME/.config/nix"
|
||||||
|
ln -sfn "$registry" "$TEST_HOME/.config/nix/registry.json"
|
||||||
|
nix flake metadata flake1
|
||||||
|
expectStderr 1 nix flake update --flake-registry '' --flake "$flake3Dir" | grepQuiet "cannot find flake 'flake:flake1' in the flake registries"
|
||||||
|
rm "$TEST_HOME/.config/nix/registry.json"
|
||||||
|
|
||||||
# Test whether flakes are registered as GC roots for offline use.
|
# Test whether flakes are registered as GC roots for offline use.
|
||||||
# FIXME: use tarballs rather than git.
|
# FIXME: use tarballs rather than git.
|
||||||
rm -rf "$TEST_HOME/.cache"
|
rm -rf "$TEST_HOME/.cache"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue