Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check whether flag registry is compeletely used #2959

Closed
wants to merge 1 commit into from

Conversation

CSVdB
Copy link
Contributor

@CSVdB CSVdB commented Jun 19, 2019

Fixes #2841
Also put the registries in the EvalState.

{
for (auto info : evalState->registries[flake::FLAG_REGISTRY]->entries) {
if (!info.second.used)
warn("the flag flake override %s to %s is not used",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence doesn't quite parse. Maybe change to something like unused flag '--flake-override %s %s'?

@@ -70,6 +70,8 @@ struct EvalCommand : virtual StoreCommand, MixEvalArgs
{
ref<EvalState> getEvalState();

~EvalCommand();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with printing the warning from the destructor is that you only get the warning after building, which could be a long time. You don't want to have Nix build stuff for an hour to then find out that your flag was ignored. Maybe the check can be done after resolveFlake() (e.g. in InstallableFlake)?

@edolstra
Copy link
Member

This breaks 4 tests, e.g.

running test tests/nix-copy-ssh.sh... [FAIL]
    + clearStore
    + echo 'clearing store...'
    clearing store...
    + chmod -R +w /tmp/nix-shell.Up1JSe/nix-test/store
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/store
    + mkdir /tmp/nix-shell.Up1JSe/nix-test/store
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/var/nix
    + mkdir /tmp/nix-shell.Up1JSe/nix-test/var/nix
    + nix-store --init
    + clearProfiles
    + profiles=/tmp/nix-shell.Up1JSe/nix-test/var/nix/profiles
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/var/nix/profiles
    + clearCache
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/binary-cache
    + remoteRoot=/tmp/nix-shell.Up1JSe/nix-test/store2
    + chmod -R u+w /tmp/nix-shell.Up1JSe/nix-test/store2
    chmod: cannot access '/tmp/nix-shell.Up1JSe/nix-test/store2': No such file or directory
    + true
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/store2
    ++ nix-build --no-out-link dependencies.nix
    these derivations will be built:
      /tmp/nix-shell.Up1JSe/nix-test/store/dv1bjx2lqpx6fnwwbdsq9pwrpajcqsa1-dependencies-input-1.drv
      /tmp/nix-shell.Up1JSe/nix-test/store/i4xbg3fghmaabq8ccjvbcjwgimc4imgz-dependencies-input-2.drv
      /tmp/nix-shell.Up1JSe/nix-test/store/nxv4lckdrfxqcz9ixhm0f9031zywn9fb-dependencies.drv
    building '/tmp/nix-shell.Up1JSe/nix-test/store/dv1bjx2lqpx6fnwwbdsq9pwrpajcqsa1-dependencies-input-1.drv'...
    building '/tmp/nix-shell.Up1JSe/nix-test/store/i4xbg3fghmaabq8ccjvbcjwgimc4imgz-dependencies-input-2.drv'...
    building '/tmp/nix-shell.Up1JSe/nix-test/store/nxv4lckdrfxqcz9ixhm0f9031zywn9fb-dependencies.drv'...
    FOO
    + outPath=/tmp/nix-shell.Up1JSe/nix-test/store/qg77gr8w7hs6hsaffgl5lh3ilsy2hcpn-dependencies
    + nix copy --to 'ssh://localhost?store=/tmp/nix-shell.Up1JSe/nix-test/store&remote-store=/tmp/nix-shell.Up1JSe/nix-test/store2%3fstore=/tmp/nix-shell.Up1JSe/nix-test/store%26real=/tmp/nix-shell.Up1JSe/nix-test/store2/tmp/nix-shell.Up1JSe/nix-test/store' /tmp/nix-shell.Up1JSe/nix-test/store/qg77gr8w7hs6hsaffgl5lh3ilsy2hcpn-dependencies
    + '[' -f /tmp/nix-shell.Up1JSe/nix-test/store2/tmp/nix-shell.Up1JSe/nix-test/store/qg77gr8w7hs6hsaffgl5lh3ilsy2hcpn-dependencies/foobar ']'
    + clearStore
    + echo 'clearing store...'
    clearing store...
    + chmod -R +w /tmp/nix-shell.Up1JSe/nix-test/store
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/store
    + mkdir /tmp/nix-shell.Up1JSe/nix-test/store
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/var/nix
    + mkdir /tmp/nix-shell.Up1JSe/nix-test/var/nix
    + nix-store --init
    + clearProfiles
    + profiles=/tmp/nix-shell.Up1JSe/nix-test/var/nix/profiles
    + rm -rf /tmp/nix-shell.Up1JSe/nix-test/var/nix/profiles
    + nix copy --no-check-sigs --from 'ssh://localhost?store=/tmp/nix-shell.Up1JSe/nix-test/store&remote-store=/tmp/nix-shell.Up1JSe/nix-test/store2%3fstore=/tmp/nix-shell.Up1JSe/nix-test/store%26real=/tmp/nix-shell.Up1JSe/nix-test/store2/tmp/nix-shell.Up1JSe/nix-test/store' /tmp/nix-shell.Up1JSe/nix-test/store/qg77gr8w7hs6hsaffgl5lh3ilsy2hcpn-dependencies
    error: operation 'addTempRoot' is not supported by store 'ssh://localhost'

Not sure why. It probably has something to do with the changes in installables.cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants