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

Weird nix develop error #1891

Open
suimong opened this issue Apr 13, 2024 · 9 comments
Open

Weird nix develop error #1891

suimong opened this issue Apr 13, 2024 · 9 comments

Comments

@suimong
Copy link
Contributor

suimong commented Apr 13, 2024

Describe the bug

On the latest master, nix develop fails with the following error:

       error: Cannot find Git revision 'a99d905216cc0aac5de0c3050f4afc54e21c6bc5' in ref 'refs/heads/master' of repository 'https://git.savannah.gnu.org/git/bash.git'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.

I tried on NixOS as well as Ubuntu with nix installed, the errors are the same.

Here is the full trace:

nix develop --show-trace

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildInputs' of derivation 'nix-shell'
         at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:395:7:
          394|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          395|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          396|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;while evaluating derivation 'topiary-0.3.0'
         whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'cargoArtifacts' of derivation 'topiary-0.3.0'
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/mkCargoDerivation.nix:44:10:
           43| chosenStdenv.mkDerivation (cleanedArgs // {
           44|   inherit cargoArtifacts;
             |          ^
           45|while evaluating derivation 'topiary-deps-0.3.0'
         whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'cargoVendorDir' of derivation 'topiary-deps-0.3.0'
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/mkCargoDerivation.nix:54:3:
           53|   # access. Directory structure should basically follow the output of `cargo vendor`.
           54|   cargoVendorDir = args.cargoVendorDir or (vendorCargoDeps args);
             |   ^
           55|while evaluating derivation 'vendor-cargo-deps'
         whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'vendor-cargo-deps'
         at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/build-support/trivial-builders/default.nix:87:14:
           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       … from call site
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/vendorMultipleCargoDeps.nix:77:5:
           76|   ${linkSources vendoredRegistries.sources}
           77|   ${linkSources vendoredGit.sources}
             |     ^
           78| ''while calling 'linkSources'
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/vendorMultipleCargoDeps.nix:63:17:
           62|
           63|   linkSources = sources: concatMapStrings
             |                 ^
           64|     (name: ''

       … from call site
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/vendorMultipleCargoDeps.nix:63:26:
           62|
           63|   linkSources = sources: concatMapStrings
             |                          ^
           64|     (name: ''while calling 'concatMapStrings'
         at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/lib/strings.nix:60:25:
           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           61|while calling anonymous lambda
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/vendorMultipleCargoDeps.nix:64:6:
           63|   linkSources = sources: concatMapStrings
           64|     (name: ''
             |      ^
           65|       ln -s ${escapeShellArg sources.${name}} $out/${escapeShellArg name}

       … from call site
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/vendorMultipleCargoDeps.nix:65:15:
           64|     (name: ''
           65|       ln -s ${escapeShellArg sources.${name}} $out/${escapeShellArg name}
             |               ^
           66|     '')

       … while calling 'escapeShellArg'
         at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/lib/strings.nix:443:20:
          442|   */
          443|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          444|while evaluating derivation 'linkLockedDeps'
         whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'linkLockedDeps'
         at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/build-support/trivial-builders/default.nix:87:14:
           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       … while calling anonymous lambda
         at /nix/store/q6y6d512iwxs8qplsgsn14jkbwdawg96-source/lib/vendorGitDeps.nix:101:12:
          100|         linkPsInLock = concatStringsSep "\n" (map
          101|           (p:
             |            ^
          102|             letwhile evaluating derivation 'cargo-git'
         whose name attribute is located at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'cargo-git'
         at /nix/store/hw0mp7awqma06m6s2h9yckyccxb63nqx-source/pkgs/build-support/trivial-builders/default.nix:87:14:
           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       error: Cannot find Git revision 'a99d905216cc0aac5de0c3050f4afc54e21c6bc5' in ref 'refs/heads/master' of repository 'https://git.savannah.gnu.org/git/bash.git'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.

To Reproduce

git clone https://githubcom/tweag/nickel.git
cd nickel
nix develop

Expected behavior
Enter the development shell.

@yannham
Copy link
Member

yannham commented Apr 15, 2024

We're seeing that when trying to update to latest Nixpkgs as well: #1733. We've had that before and I believe it's related to Topiary, which pulls a bash grammar in. However it should work with the current lockfile, as this is what we use on the CI. Did you update the lockfile, by any chance?

@suimong
Copy link
Contributor Author

suimong commented Apr 15, 2024

I tried the stock lockfile AND an updated lockfile but the issue is the same. I just tried cloning fresh from tweag/nickel and nix develop, same issue.

@yannham
Copy link
Member

yannham commented Apr 15, 2024

Ah. Thanks for the report. Looking into this with Topiary people. In the meantime, pinning the Nixpkgs input to latest stable instead of unstable might be worth trying (but also might not work, I haven't tried)

@suimong
Copy link
Contributor Author

suimong commented Apr 15, 2024

It's very weird, I tried with the 1.5.0-release branch, but still got the same issue...

@yannham
Copy link
Member

yannham commented Jun 7, 2024

Sorry to come back to this only now, but nix develop seems to be fixed on latest master. I suspect this was due to a Topiary issue. Feel free to reopen if it's not fixed for you.

@yannham yannham closed this as completed Jun 7, 2024
@suimong
Copy link
Contributor Author

suimong commented Jun 13, 2024

@yannham Unfortunately I still saw the same issue with the latest master. This time I even tried with a fresh install of Ubuntu 24.04 and a fresh install of nix (along with my main NixOS workstation). Here is the stack trace (almost the same as before):

> nix develop --show-trace
error: Server does not allow request for unadvertised object a99d905216cc0aac5de0c3050f4afc54e21c6bc5
warning: could not update mtime for file '/home/yjx/.cache/nix/gitv3/1ir2mbkkzsy6xdrkx24b85ljiv4np328w9g1lx577l25jwi0g2in/refs/heads/master': No such file or directory
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildInputs' of derivation 'nix-shell'
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:378:7:
          377|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          378|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          379|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'topiary-0.4.1'
         whose name attribute is located at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'cargoArtifacts' of derivation 'topiary-0.4.1'
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/mkCargoDerivation.nix:59:11:
           58| } // {
           59|   inherit cargoArtifacts;
             |           ^
           60|while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'topiary-deps-0.4.1'
         whose name attribute is located at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'cargoVendorDir' of derivation 'topiary-deps-0.4.1'
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/mkCargoDerivation.nix:69:3:
           68|   # access. Directory structure should basically follow the output of `cargo vendor`.
           69|   cargoVendorDir = args.cargoVendorDir or (vendorCargoDeps args);
             |   ^
           70|while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'vendor-cargo-deps'
         whose name attribute is located at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'vendor-cargo-deps'
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/build-support/trivial-builders/default.nix:68:17:
           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                 ^
           69|         passAsFile = [ "buildCommand" ]

       … from call site
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorMultipleCargoDeps.nix:83:5:
           82|   ${linkSources vendoredRegistries.sources}
           83|   ${linkSources vendoredGit.sources}
             |     ^
           84| ''while calling 'linkSources'
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorMultipleCargoDeps.nix:69:17:
           68|
           69|   linkSources = sources: concatMapStrings
             |                 ^
           70|     (name: ''

       … from call site
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorMultipleCargoDeps.nix:69:26:
           68|
           69|   linkSources = sources: concatMapStrings
             |                          ^
           70|     (name: ''while calling 'concatMapStrings'
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/lib/strings.nix:60:25:
           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           61|while calling the 'concatStringsSep' builtin
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/lib/strings.nix:60:31:
           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                               ^
           61|while calling anonymous lambda
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorMultipleCargoDeps.nix:70:6:
           69|   linkSources = sources: concatMapStrings
           70|     (name: ''
             |      ^
           71|       ln -s ${escapeShellArg sources.${name}} $out/${escapeShellArg name}

       … from call site
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorMultipleCargoDeps.nix:71:15:
           70|     (name: ''
           71|       ln -s ${escapeShellArg sources.${name}} $out/${escapeShellArg name}
             |               ^
           72|     '')

       … while calling 'escapeShellArg'
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/lib/strings.nix:454:20:
          453|   */
          454|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          455|while calling the 'replaceStrings' builtin
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/lib/strings.nix:454:29:
          453|   */
          454|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                             ^
          455|while evaluating the third argument passed to builtins.replaceStrings

       … while calling the 'toString' builtin
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/lib/strings.nix:454:61:
          453|   */
          454|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                                                             ^
          455|while calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'linkLockedDeps'
         whose name attribute is located at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'linkLockedDeps'
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/build-support/trivial-builders/default.nix:68:17:
           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                 ^
           69|         passAsFile = [ "buildCommand" ]

       … while calling the 'concatStringsSep' builtin
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorGitDeps.nix:110:24:
          109|         # https://github.com/ipetkov/crane/issues/60
          110|         linkPsInLock = concatStringsSep "\n" (map
             |                        ^
          111|           (p:

       … while calling anonymous lambda
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/vendorGitDeps.nix:111:12:
          110|         linkPsInLock = concatStringsSep "\n" (map
          111|           (p:
             |            ^
          112|             letwhile calling the 'getAttr' builtin
         at <nix/derivation-internal.nix>:19:19:
           18|       value = commonAttrs // {
           19|         outPath = builtins.getAttr outputName strict;
             |                   ^
           20|         drvPath = strict.drvPath;while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:9:12:
            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|while evaluating derivation 'cargo-git'
         whose name attribute is located at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'cargo-git'
         at /nix/store/3dr5pyja36lvvrszhzffww1jwyrx6i09-source/pkgs/build-support/trivial-builders/default.nix:68:17:
           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                 ^
           69|         passAsFile = [ "buildCommand" ]

       … while calling the 'fetchGit' builtin
         at /nix/store/s1cnnplqrk8w595dp9fb5cv84xj61lgx-source/lib/downloadCargoPackageFromGit.nix:24:7:
           23|     if sha256 == null then
           24|       builtins.fetchGit
             |       ^
           25|         (maybeRef // {

       … while fetching the input 'git+https://github.com/tree-sitter/tree-sitter-bash?rev=1b0321ee85701d5036c334a6f04761cdc672e64c&submodules=1'while fetching the input 'git+https://git.savannah.gnu.org/git/bash.git?rev=a99d905216cc0aac5de0c3050f4afc54e21c6bc5'

       error: Cannot find Git revision 'a99d905216cc0aac5de0c3050f4afc54e21c6bc5' in ref 'refs/heads/master' of repository 'https://git.savannah.gnu.org/git/bash.git'! Please make sure that the rev exists on the ref you've specified or add allRefs = true; to fetchGit.

@yannham
Copy link
Member

yannham commented Jun 13, 2024

I saw this error on the CI very recently, but it just went away. I unfortunately can't reproduce on my end on a Debian with Nix installed, using nix version 2.18.2. Re-opening, still. Maybe the way forward is to package Nickel queries for Topiary independently, as we don't really care about Bash formatting, which is the reason why we pull this flaky dep in the first place.

@yannham yannham reopened this Jun 13, 2024
@suimong
Copy link
Contributor Author

suimong commented Jun 13, 2024

I saw this error on the CI very recently, but it just went away. I unfortunately can't reproduce on my end on a Debian with Nix installed, using nix version 2.18.2. Re-opening, still. Maybe the way forward is to package Nickel queries for Topiary independently, as we don't really care about Bash formatting, which is the reason why we pull this flaky dep in the first place.

Ah, I found the culprit: nix version 2.18.2 can indeed run nix develop without error, but errors for newer nix versions e.g. 2.20.2.

@yannham
Copy link
Member

yannham commented Jun 13, 2024

That is...interesting 😅 but good catch, we know at least where too look at.

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

No branches or pull requests

2 participants