input-output-hk / plutus-starter

A starter project for Plutus apps
Apache License 2.0
199 stars 95 forks source link

Error running nix-shell on Mac M1 Bad file descriptor #45

Closed deanodev closed 2 years ago

deanodev commented 2 years ago

After cloning the repo cd Plutus-Starter. %nix-shell

Error message:

` nix-shell building '/nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv'...

ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor error: builder for '/nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv' failed with exit code 1; last 2 log lines:

ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor For full logs, run 'nix log /nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv'. (use '--show-trace' to show detailed location information) `

taking a look at log:

` nix log /nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv ^A ^E^@^@^@^@^@^@^@Error^@^@^@^@^@^@^@^@^@^@^@^E^@^@^@^@^@^@^@Error^@^@^@x^@^@^@^@^@^@^@executing '/nix/store/715y5lnw12vdcc3h> lines 1-2/2 (END)

`

` cat /etc/nix/nix.conf

build-users-group = nixbld substituters = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

system = x86_64-darwin extra-platforms = x86_64-darwin aarch64-darwin

sandbox = false extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env experimental-features = nix-command extra-experimental-features = flakes `

Full trace:

` nix-shell --show-trace building '/nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv'...

ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor error: builder for '/nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv' failed with exit code 1; last 2 log lines:

ErrorErrorxexecuting '/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23/bin/bash': Bad file descriptor For full logs, run 'nix log /nix/store/j9wy6in0pqy949xczzf22rc9fz3fhj0z-source.drv'.

   … while realising the context of path '/nix/store/bvynxhgsxhp6ds11ak1wnjx5h8avmfwf-source'

   at /nix/store/zcdnvr0wr3m8lq0fsnn54fk44za722cm-plutus-apps-src/default.nix:13:16:

       12| , sources ? import ./nix/sources.nix { inherit system; } // sourcesOverride
       13| , haskellNix ? import sources.haskell-nix {
         |                ^
       14|     pkgs = import sources.nixpkgs { inherit system; };

   … while evaluating 'isFunction'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/trivial.nix:345:16:

      344|   */
      345|   isFunction = f: builtins.isFunction f ||
         |                ^
      346|     (f ? __functor && isFunction (f.__functor f));

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:64:8:

       63|   config1 =
       64|     if lib.isFunction config0
         |        ^
       65|     then config0 { inherit pkgs; }

   … while evaluating the attribute 'config'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:74:9:

       73|         # filter-out known options, FIXME: remove this eventually
       74|         config = builtins.intersectAttrs options config1;
         |         ^
       75|       })

   … while evaluating 'addMeta'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:260:17:

      259|     let
      260|       addMeta = config: if m ? meta
         |                 ^
      261|         then mkMerge [ config { meta = m.meta; } ]

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:277:37:

      276|           options = m.options or {};
      277|           config = addFreeformType (addMeta (m.config or {}));
         |                                     ^
      278|         }

   … while evaluating 'addFreeformType'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:263:25:

      262|         else config;
      263|       addFreeformType = config: if m ? freeformType
         |                         ^
      264|         then mkMerge [ config { _module.freeformType = m.freeformType; } ]

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:277:20:

      276|           options = m.options or {};
      277|           config = addFreeformType (addMeta (m.config or {}));
         |                    ^
      278|         }

   … while evaluating the attribute 'config'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:277:11:

      276|           options = m.options or {};
      277|           config = addFreeformType (addMeta (m.config or {}));
         |           ^
      278|         }

   … while evaluating 'pushDownProperties'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:589:24:

      588|   */
      589|   pushDownProperties = cfg:
         |                        ^
      590|     if cfg._type or "" == "merge" then

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:339:73:

      338|     mergeModules' prefix modules
      339|       (concatMap (m: map (config: { file = m._file; inherit config; }) (pushDownProperties m.config)) modules);
         |                                                                         ^
      340|

   … while evaluating anonymous lambda

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:339:19:

      338|     mergeModules' prefix modules
      339|       (concatMap (m: map (config: { file = m._file; inherit config; }) (pushDownProperties m.config)) modules);
         |                   ^
      340|

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:339:8:

      338|     mergeModules' prefix modules
      339|       (concatMap (m: map (config: { file = m._file; inherit config; }) (pushDownProperties m.config)) modules);
         |        ^
      340|

   … while evaluating 'byName'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:364:25:

      363|       */
      364|       byName = attr: f: modules:
         |                         ^
      365|         foldl' (acc: module:

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:387:21:

      386|       # an attrset 'name' => list of submodules that define ‘name’.
      387|       defnsByName = byName "config" (module: value:
         |                     ^
      388|           map (config: { inherit (module) file; inherit config; }) (pushDownProperties value)

   … while evaluating 'byName'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:364:25:

      363|       */
      364|       byName = attr: f: modules:
         |                         ^
      365|         foldl' (acc: module:

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:391:22:

      390|       # extract the definitions for each loc
      391|       defnsByName' = byName "config" (module: value:
         |                      ^
      392|           [{ inherit (module) file; inherit value; }]

   … while evaluating the attribute 'values'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:650:7:

      649|     in {
      650|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
         |       ^
      651|       inherit highestPrio;

   … while evaluating the attribute 'values'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:551:9:

      550|       in {
      551|         values = defs''';
         |         ^
      552|         inherit (defs'') highestPrio;

   … while evaluating the attribute 'mergedValue'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:557:5:

      556|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
      557|     mergedValue =
         |     ^
      558|       if isDefined then

   … while evaluating the option `_module.freeformType':

   … while evaluating the attribute 'value'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:525:9:

      524|     in warnDeprecation opt //
      525|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
         |         ^
      526|         inherit (res.defsFinal') highestPrio;

   … while evaluating anonymous lambda

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:140:72:

      139|           # For definitions that have an associated option
      140|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
         |                                                                        ^
      141|

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/attrsets.nix:301:20:

      300|               then recurse (path ++ [name]) value
      301|               else f (path ++ [name]) value;
         |                    ^
      302|         in mapAttrs g set;

   … while evaluating 'g'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/attrsets.nix:298:19:

      297|           g =
      298|             name: value:
         |                   ^
      299|             if isAttrs value && cond value

   … from call site

   … while evaluating 'evalModules'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/modules.nix:63:17:

       62|      evalModules) and the less declarative the module set is. */
       63|   evalModules = { modules
         |                 ^
       64|                 , prefix ? []

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:68:16:

       67|
       68|   configEval = lib.evalModules {
         |                ^
       69|     modules = [

   … while evaluating 'fold''

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/lists.nix:55:15:

       54|       len = length list;
       55|       fold' = n:
         |               ^
       56|         if n == len

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/lists.nix:59:8:

       58|         else op (elemAt list n) (fold' (n + 1));
       59|     in fold' 0;
         |        ^
       60|

   … while evaluating 'foldr'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/lists.nix:52:20:

       51|   */
       52|   foldr = op: nul: list:
         |                    ^
       53|     let

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/trivial.nix:311:33:

      310|
      311|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
         |                                 ^
      312|

   … while evaluating 'showWarnings'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/trivial.nix:311:28:

      310|
      311|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
         |                            ^
      312|

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:80:12:

       79|   # take all the rest as-is
       80|   config = lib.showWarnings configEval.config.warnings
         |            ^
       81|     (config1 // builtins.removeAttrs configEval.config [ "_module" ]);

   … while evaluating anonymous lambda

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/default.nix:7:1:

        6|
        7| { # Args just for stdenvs' usage
         | ^
        8|   lib

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:118:12:

      117|
      118|   stages = stdenvStages {
         |            ^
      119|     inherit lib localSystem crossSystem config overlays crossOverlays;

   … while evaluating 'reverseList'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/lists.nix:393:17:

      392|   */
      393|   reverseList = xs:
         |                 ^
      394|     let l = length xs; in genList (n: elemAt xs (l - n - 1)) l;

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:85:6:

       84|       // (stageFun prevStage))
       85|     (lib.lists.reverseList stageFuns);
         |      ^
       86|

   … while evaluating 'imap1'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/lib/lists.nix:116:14:

      115|   */
      116|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
         |              ^
      117|

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:78:30:

       77|   # isn't already set.
       78|   withAllowCustomOverrides = lib.lists.imap1
         |                              ^
       79|     (index: stageFun: prevStage:

   … while evaluating 'go'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:63:18:

       62|       len = builtins.length list;
       63|       go = pred: n:
         |                  ^
       64|         if n == len

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:72:13:

       71|       lapp = lnul cur;
       72|       cur = go lapp 0;
         |             ^
       73|     in cur;

   … while evaluating 'dfold'

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:60:27:

       59|   */
       60|   dfold = op: lnul: rnul: list:
         |                           ^
       61|     let

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:136:4:

      135|
      136| in dfold folder postStage (_: {}) withAllowCustomOverrides
         |    ^

   … while evaluating anonymous lambda

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/stdenv/booter.nix:42:1:

       41| # other words, this does a foldr not foldl.
       42| stageFuns: let
         | ^
       43|

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:122:10:

      121|
      122|   pkgs = boot stages;
         |          ^
      123|

   … while evaluating anonymous lambda

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/default.nix:19:1:

       18|
       19| { # The system packages will be built on. See the manual for the
         | ^
       20|   # subtle division of labor between these two `*System`s and the three

   … from call site

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/impure.nix:83:1:

       82|
       83| import ./. (builtins.removeAttrs args [ "system" ] // {
         | ^
       84|   inherit config overlays localSystem;

   … while evaluating anonymous lambda

   at /nix/store/kawxd91ly09hlyqprqs7yn650s3cfvf6-source/pkgs/top-level/impure.nix:15:1:

       14|
       15| { # We put legacy `system` into `localSystem`, if `localSystem` was not passed.
         | ^
       16|   # If neither is passed, assume we are building packages on the current

   … from call site

   at /nix/store/zcdnvr0wr3m8lq0fsnn54fk44za722cm-plutus-apps-src/nix/default.nix:30:10:

       29|
       30|   pkgs = import sources.nixpkgs {
         |          ^
       31|     inherit crossSystem;

   … while evaluating the attribute 'pkgs'

   at /nix/store/zcdnvr0wr3m8lq0fsnn54fk44za722cm-plutus-apps-src/nix/default.nix:44:10:

       43| {
       44|   inherit pkgs plutus-apps sources;
         |          ^
       45| }

   … while evaluating the attribute 'pkgs'

   at /nix/store/zcdnvr0wr3m8lq0fsnn54fk44za722cm-plutus-apps-src/default.nix:32:10:

       31| rec {
       32|   inherit pkgs plutus-apps;
         |          ^
       33|

   … while evaluating the attribute 'haskell'

   at /Users/deano/plutus/plutus-starter/nix/pkgs/default.nix:29:10:

       28| {
       29|   inherit haskell hlint cabal-install stylish-haskell haskell-language-server cardano-repo-tool;
         |          ^
       30| }

   … while evaluating anonymous lambda

   at /Users/deano/plutus/plutus-starter/shell.nix:1:1:

        1| { pure ? false, source-repo-override ? { } }:
         | ^
        2| let

   … from call site

`

deanodev commented 2 years ago

I don't know that this is specific to the Starter Project as I am also seeing similar File Descriptor error when I run nix build on the Plutus-Apps root directory.

deanodev commented 2 years ago

This issue was due to either a corrupt download of the cache or corrupt cache. Its resolved as of now and everything is compiling ok.