Skip to content

Commit

Permalink
fixup! Make registries a config option (and remove --no-registries flag)
Browse files Browse the repository at this point in the history
  • Loading branch information
balsoft committed Jul 16, 2021
1 parent 243fdf3 commit 82148d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcmd/installables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ MixFlakeOptions::MixFlakeOptions()
.longName = "no-registries",
.description = "Don't allow lookups in the flake registries.",
.category = category,
.handler = {[&](bool b) {
lockFlags.useRegistries = b;
.handler = {[&]() {
lockFlags.useRegistries = false;
warn("--no-registries is deprecated; use --no-use-registries (a.k.a --option use-registries false)");
}}
});
Expand Down
4 changes: 4 additions & 0 deletions tests/flakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"git+file://$flake1Di

# Building a flake with an unlocked dependency should fail in pure mode.
(! nix build -o $TEST_ROOT/result flake2#bar --no-registries)
(! nix build -o $TEST_ROOT/result flake2#bar --no-use-registries)
(! nix eval --expr "builtins.getFlake \"$flake2Dir\"")

# But should succeed in impure mode.
Expand All @@ -170,6 +171,7 @@ nix build -o $TEST_ROOT/result $flake2Dir#bar
# Building with a lockfile should not require a fetch of the registry.
nix build -o $TEST_ROOT/result --flake-registry file:///no-registry.json $flake2Dir#bar --refresh
nix build -o $TEST_ROOT/result --no-registries $flake2Dir#bar --refresh
nix build -o $TEST_ROOT/result --no-use-registries $flake2Dir#bar --refresh

# Updating the flake should not change the lockfile.
nix flake lock $flake2Dir
Expand All @@ -180,6 +182,7 @@ nix build -o $TEST_ROOT/result flake2#bar

# Or without a registry.
nix build -o $TEST_ROOT/result --no-registries git+file://$flake2Dir#bar --refresh
nix build -o $TEST_ROOT/result --no-use-registries git+file://$flake2Dir#bar --refresh

# Test whether indirect dependencies work.
nix build -o $TEST_ROOT/result $flake3Dir#xyzzy
Expand Down Expand Up @@ -603,6 +606,7 @@ nix flake metadata --json hg+file://$flake5Dir
[[ $(nix flake metadata --json hg+file://$flake5Dir | jq -e -r .revCount) = 1 ]]

nix build -o $TEST_ROOT/result hg+file://$flake5Dir --no-registries --no-allow-dirty
nix build -o $TEST_ROOT/result hg+file://$flake5Dir --no-use-registries --no-allow-dirty

# Test tarball flakes
tar cfz $TEST_ROOT/flake.tar.gz -C $TEST_ROOT --exclude .hg flake5
Expand Down

0 comments on commit 82148d7

Please sign in to comment.