naersk icon indicating copy to clipboard operation
naersk copied to clipboard

Doesn't eval in chroot store.

Open kevincox opened this issue 3 years ago • 2 comments

The docs around chroot stores are basically non-existant so I may be doing it wrong but it appears as though the following should work but doesn't. It is also possible that the bug is in nix not naersk.

% nix-build --eval-store /tmp/store --store /tmp/store --show-trace
error: Naersk requires Cargo.lock to be available in root. Check that it is not in .gitignore and stage it when using git to filter sources (which flakes does)
--show-trace output
   … while evaluating the attribute &apos;<font color="#A347BA"><b>cargolock</b></font>&apos;

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/config.nix:352:5</b></font>:

      351|     # The cargo lock
      352|     cargolock =
         |     <font color="#C01C28"><b>^</b></font>
      353|       let

   … while evaluating <font color="#A347BA"><b>&apos;mkVersions&apos;</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/lib.nix:13:16</b></font>:

       12|   #   [ { name = &quot;wabt&quot;, version = &quot;2.0.6&quot;, sha256 = &quot;...&quot; } ]
       13|   mkVersions = cargolock:
         |                <font color="#C01C28"><b>^</b></font>
       14|     if builtins.hasAttr &quot;metadata&quot; cargolock then

   … from call site

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/config.nix:243:25</b></font>:

      242|     #   [ { name = &quot;wabt&quot;, version = &quot;2.0.6&quot;, sha256 = &quot;...&quot; } ]
      243|     crateDependencies = libb.mkVersions buildPlanConfig.cargolock;
         |                         <font color="#C01C28"><b>^</b></font>
      244|   };

   … while evaluating the attribute &apos;<font color="#A347BA"><b>paths</b></font>&apos; of the derivation &apos;<font color="#A347BA"><b>crates-io</b></font>&apos;

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7</b></font>:

      204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname &amp;&amp; attrs ? version)) {
      205|       name =
         |       <font color="#C01C28"><b>^</b></font>
      206|         let

   … while evaluating <font color="#A347BA"><b>&apos;outputVal&apos;</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:41:15</b></font>:

       40|
       41|   outputVal = v:
         |               <font color="#C01C28"><b>^</b></font>
       42|     let

   … from call site

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:39:9</b></font>:

       38|           &quot;{ ${valsStr} }&quot; else
       39|         outputVal v;
         |         <font color="#C01C28"><b>^</b></font>
       40|

   … while evaluating <font color="#A347BA"><b>&apos;outputValInner&apos;</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:28:20</b></font>:

       27|
       28|   outputValInner = v:
         |                    <font color="#C01C28"><b>^</b></font>
       29|     let

   … from call site

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:69:42</b></font>:

       68|           vals = mapAttrsToList
       69|             (k&apos;: v&apos;: &quot;${quoteKey k&apos;} = ${outputValInner v&apos;}&quot;) v;
         |                                          <font color="#C01C28"><b>^</b></font>
       70|           valsStr = concatStringsSep &quot;, &quot; vals;

   … while evaluating <font color="#A347BA"><b>anonymous lambda</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:69:18</b></font>:

       68|           vals = mapAttrsToList
       69|             (k&apos;: v&apos;: &quot;${quoteKey k&apos;} = ${outputValInner v&apos;}&quot;) v;
         |                  <font color="#C01C28"><b>^</b></font>
       70|           valsStr = concatStringsSep &quot;, &quot; vals;

   … from call site

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/lib/attrsets.nix:259:16</b></font>:

      258|   mapAttrsToList = f: attrs:
      259|     map (name: f name attrs.${name}) (attrNames attrs);
         |                <font color="#C01C28"><b>^</b></font>
      260|

   … while evaluating <font color="#A347BA"><b>anonymous lambda</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/lib/attrsets.nix:259:10</b></font>:

      258|   mapAttrsToList = f: attrs:
      259|     map (name: f name attrs.${name}) (attrNames attrs);
         |          <font color="#C01C28"><b>^</b></font>
      260|

   … from call site

   … while evaluating <font color="#A347BA"><b>anonymous lambda</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:133:10</b></font>:

      132|       concatMapStringsSep &quot;\n&quot;
      133|         (kv: concatStringsSep &quot;\n&quot; (outputKeyVal kv.k kv.v))
         |          <font color="#C01C28"><b>^</b></font>
      134|         (

   … from call site

   … while evaluating <font color="#A347BA"><b>&apos;concatMapStringsSep&apos;</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/lib/strings.nix:110:5</b></font>:

      109|     # List of input strings
      110|     list: concatStringsSep sep (map f list);
         |     <font color="#C01C28"><b>^</b></font>
      111|

   … from call site

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:132:7</b></font>:

      131|     in
      132|       concatMapStringsSep &quot;\n&quot;
         |       <font color="#C01C28"><b>^</b></font>
      133|         (kv: concatStringsSep &quot;\n&quot; (outputKeyVal kv.k kv.v))

   … while evaluating <font color="#A347BA"><b>&apos;toTOML&apos;</b></font>

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/builtins/to-toml.nix:119:12</b></font>:

      118|
      119|   toTOML = attrs:
         |            <font color="#C01C28"><b>^</b></font>
      120|     assert (typeOf attrs == &quot;set&quot;);

   … from call site

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/tmp/store/nix/store/hjypddv3hislmga0hrwyy6fi2mkqaazp-source/build.nix:154:19</b></font>:

      153|     # and git dependencies.
      154|     cargoconfig = builtinz.toTOML {
         |                   <font color="#C01C28"><b>^</b></font>
      155|       source = {

   … while evaluating the attribute &apos;<font color="#A347BA"><b>cargoconfig</b></font>&apos; of the derivation &apos;<font color="#A347BA"><b>feed-test-deps-0.1.0</b></font>&apos;

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7</b></font>:

      204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname &amp;&amp; attrs ? version)) {
      205|       name =
         |       <font color="#C01C28"><b>^</b></font>
      206|         let

   … while evaluating the attribute &apos;<font color="#A347BA"><b>builtDependencies</b></font>&apos; of the derivation &apos;<font color="#A347BA"><b>feed-test-0.1.0</b></font>&apos;

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7</b></font>:

      204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname &amp;&amp; attrs ? version)) {
      205|       name =
         |       <font color="#C01C28"><b>^</b></font>
      206|         let

   … while evaluating the attribute &apos;<font color="#A347BA"><b>text</b></font>&apos; of the derivation &apos;<font color="#A347BA"><b>feed-test-config.json</b></font>&apos;

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7</b></font>:

      204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname &amp;&amp; attrs ? version)) {
      205|       name =
         |       <font color="#C01C28"><b>^</b></font>
      206|         let

   … while evaluating the attribute &apos;<font color="#A347BA"><b>baseJson</b></font>&apos; of the derivation &apos;<font color="#A347BA"><b>docker-image-feed-test.tar.gz</b></font>&apos;

   <font color="#12488B"><b>at </b></font><font color="#A347BA"><b>/nix/store/i9i9cr2mdyh1slzgqlw32idbngqk12c1-nixos-22.05pre338578.a2e281f5770/nixos/pkgs/stdenv/generic/make-derivation.nix:205:7</b></font>:

      204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname &amp;&amp; attrs ? version)) {
      205|       name =
         |       <font color="#C01C28"><b>^</b></font>
      206|         let

This was performed in a clean checkout of https://gitlab.com/kevincox/feed-test but seems to happen on all naersk repos.

I also tried with just --store and just --eval-store and got the same error.

The source does appear to be in the chroot store so I don't know what is going wrong.

% l /tmp/store/nix/store/115xvqbgrn9np9nll1d18961d32rwh63-feed-test
total 64K
-r--r--r-- 2 kevincox users  45K 1969-12-31 19:00 Cargo.lock
-r--r--r-- 2 kevincox users  487 1969-12-31 19:00 Cargo.toml
-r--r--r-- 2 kevincox users 2.3K 1969-12-31 19:00 kube.ecl
-r--r--r-- 2 kevincox users  273 1969-12-31 19:00 README.md
-r--r--r-- 2 kevincox users  121 1969-12-31 19:00 renovate.json5
dr-xr-xr-x 2 kevincox users  140 1969-12-31 19:00 src
dr-xr-xr-x 2 kevincox users   60 1969-12-31 19:00 static
% l /nix/store/115xvqbgrn9np9nll1d18961d32rwh63-feed-test
ls: cannot access '/nix/store/115xvqbgrn9np9nll1d18961d32rwh63-feed-test': No such file or directory

kevincox avatar Dec 18 '21 14:12 kevincox

It is worth noting that running the build once outside of the chroot store makes the problem go away. Presumably because it is accidentally reading the sources from the host store.

kevincox avatar Dec 18 '21 14:12 kevincox

This can be worked around by passing --eval-store local along with --store /whatever.

kevincox avatar Jan 26 '22 19:01 kevincox