nocargo icon indicating copy to clipboard operation
nocargo copied to clipboard

value is a list while a set was expected

Open lelongg opened this issue 2 years ago • 3 comments

Got the following error while trying to build a package

error: value is a list while a set was expected

       … while evaluating anonymous lambda

       at /nix/store/hinskrx05kyl9ngfqd50zx189wzili66-source/lib/resolve.nix:55:14:

           54|       resolvedDependencies =
           55|         map (dep: dep // {
             |              ^
           56|           resolved = selectDep candidates dep;

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/hinskrx05kyl9ngfqd50zx189wzili66-source/lib/support.nix:168:29:

          167|       pkgSet = mapAttrs (id: info: info // {
          168|         dependencies = map (dep: dep // {
             |                             ^
          169|           targetEnabled = dep.target != null -> evalTargetCfgStr hostCfgs dep.target;

       … from call site

       … while evaluating 'depFilter'

       at /nix/store/hinskrx05kyl9ngfqd50zx189wzili66-source/lib/support.nix:204:25:

          203|             inherit pkgSet rootId rootFeatures;
          204|             depFilter = dep: dep.targetEnabled && dep.kind == "normal";
             |                         ^
          205|           };

lelongg avatar Sep 15 '22 08:09 lelongg

Could not reproduce. Please let us know what package you are building, and what's the nix expression you wrote to build it.

oxalica avatar Sep 15 '22 22:09 oxalica

Here is the expression

let ws = nocargo.lib.mkRustPackageOrWorkspace {
    src = self + /src/rust;
    gitSrcs = {
      "https://github.com/lelongg/arraydeque.git" = inputs.arraydeque;
      "https://github.com/lelongg/bayes_estimate.git?rev=17953f1665a1f24d30262c04e788819893949e37" =
        inputs.bayes-estimate;
      "https://github.com/smessmer/binary-layout" = inputs.binary-layout;
      "https://github.com/lelongg/log4rs.git" = inputs.log4rs;
    };
  };
in ws.release.cli.bin
Here is the dependency tree of the crate, but the crate is inside a workspace with even more dependencies
cli v0.2.0
├── anyhow v1.0.58
├── chrono v0.4.19
│   ├── libc v0.2.132
│   ├── num-integer v0.1.45
│   │   └── num-traits v0.2.15
│   │       [build-dependencies]
│   │       └── autocfg v1.1.0
│   │   [build-dependencies]
│   │   └── autocfg v1.1.0
│   ├── num-traits v0.2.15 (*)
│   ├── serde v1.0.137
│   │   └── serde_derive v1.0.137 (proc-macro)
│   │       ├── proc-macro2 v1.0.40
│   │       │   └── unicode-ident v1.0.1
│   │       ├── quote v1.0.20
│   │       │   └── proc-macro2 v1.0.40 (*)
│   │       └── syn v1.0.98
│   │           ├── proc-macro2 v1.0.40 (*)
│   │           ├── quote v1.0.20 (*)
│   │           └── unicode-ident v1.0.1
│   └── time v0.1.44
│       └── libc v0.2.132
├── console v0.15.0
│   ├── libc v0.2.132
│   ├── once_cell v1.13.1
│   ├── regex v1.5.6
│   │   ├── aho-corasick v0.7.18
│   │   │   └── memchr v2.5.0
│   │   ├── memchr v2.5.0
│   │   └── regex-syntax v0.6.26
│   ├── terminal_size v0.1.17
│   │   └── libc v0.2.132
│   └── unicode-width v0.1.9
├── dirs v4.0.0
│   └── dirs-sys v0.3.7
│       └── libc v0.2.132
├── dotenv v0.15.0
├── easy-parallel v3.2.0
├── flate2 v1.0.24
│   ├── crc32fast v1.3.2
│   │   └── cfg-if v1.0.0
│   └── miniz_oxide v0.5.3
│       └── adler v1.0.2
├── fs_extra v1.2.0
├── indicatif v0.16.2
│   ├── console v0.15.0 (*)
│   ├── lazy_static v1.4.0
│   ├── number_prefix v0.4.0
│   └── regex v1.5.6 (*)
├── log v0.4.17
│   └── cfg-if v1.0.0
├── maplit v1.0.2
├── network-manager v0.11.0
│   ├── ascii v0.8.7
│   ├── bitflags v1.3.2
│   ├── dbus v0.5.4
│   │   ├── libc v0.2.132
│   │   └── libdbus-sys v0.1.5
│   │       [build-dependencies]
│   │       └── pkg-config v0.3.25
│   ├── error-chain v0.11.0
│   ├── futures v0.1.31
│   ├── futures-cpupool v0.1.8
│   │   ├── futures v0.1.31
│   │   └── num_cpus v1.13.1
│   │       └── libc v0.2.132
│   ├── log v0.3.9
│   │   └── log v0.4.17 (*)
│   └── tokio-timer v0.1.2
│       ├── futures v0.1.31
│       └── slab v0.3.0
├── pretty_env_logger v0.4.0
│   ├── env_logger v0.7.1
│   │   ├── atty v0.2.14
│   │   │   └── libc v0.2.132
│   │   ├── humantime v1.3.0
│   │   │   └── quick-error v1.2.3
│   │   ├── log v0.4.17 (*)
│   │   ├── regex v1.5.6 (*)
│   │   └── termcolor v1.1.3
│   └── log v0.4.17 (*)
├── prettytable-rs v0.8.0
│   ├── atty v0.2.14 (*)
│   ├── csv v1.1.6
│   │   ├── bstr v0.2.17
│   │   │   ├── lazy_static v1.4.0
│   │   │   ├── memchr v2.5.0
│   │   │   ├── regex-automata v0.1.10
│   │   │   └── serde v1.0.137 (*)
│   │   ├── csv-core v0.1.10
│   │   │   └── memchr v2.5.0
│   │   ├── itoa v0.4.8
│   │   ├── ryu v1.0.10
│   │   └── serde v1.0.137 (*)
│   ├── encode_unicode v0.3.6
│   ├── lazy_static v1.4.0
│   ├── term v0.5.2
│   │   ├── byteorder v1.4.3
│   │   └── dirs v1.0.5
│   │       └── libc v0.2.132
│   └── unicode-width v0.1.9
├── semver v1.0.12
├── serde v1.0.137 (*)
├── serde_ini v0.2.0
│   ├── result v1.0.0
│   ├── serde v1.0.137 (*)
│   └── void v1.0.2
├── serde_json v1.0.81
│   ├── itoa v1.0.2
│   ├── ryu v1.0.10
│   └── serde v1.0.137 (*)
├── serde_yaml v0.8.24
│   ├── indexmap v1.6.2
│   │   └── hashbrown v0.9.1
│   │   [build-dependencies]
│   │   └── autocfg v1.1.0
│   ├── ryu v1.0.10
│   ├── serde v1.0.137 (*)
│   └── yaml-rust v0.4.5
│       └── linked-hash-map v0.5.4
├── shellexpand v2.1.0
│   └── dirs-next v2.0.0
│       ├── cfg-if v1.0.0
│       └── dirs-sys-next v0.1.2
│           └── libc v0.2.132
├── ssh2 v0.9.3
│   ├── bitflags v1.3.2
│   ├── libc v0.2.132
│   ├── libssh2-sys v0.2.23
│   │   ├── libc v0.2.132
│   │   ├── libz-sys v1.1.8
│   │   │   └── libc v0.2.132
│   │   │   [build-dependencies]
│   │   │   ├── cc v1.0.73
│   │   │   └── pkg-config v0.3.25
│   │   └── openssl-sys v0.9.74
│   │       └── libc v0.2.132
│   │       [build-dependencies]
│   │       ├── autocfg v1.1.0
│   │       ├── cc v1.0.73
│   │       └── pkg-config v0.3.25
│   │   [build-dependencies]
│   │   ├── cc v1.0.73
│   │   └── pkg-config v0.3.25
│   └── parking_lot v0.11.2
│       ├── instant v0.1.12
│       │   └── cfg-if v1.0.0
│       ├── lock_api v0.4.7
│       │   └── scopeguard v1.1.0
│       │   [build-dependencies]
│       │   └── autocfg v1.1.0
│       └── parking_lot_core v0.8.5
│           ├── cfg-if v1.0.0
│           ├── instant v0.1.12 (*)
│           ├── libc v0.2.132
│           └── smallvec v1.9.0
├── structopt v0.3.26
│   ├── clap v2.34.0
│   │   ├── ansi_term v0.12.1
│   │   ├── atty v0.2.14 (*)
│   │   ├── bitflags v1.3.2
│   │   ├── strsim v0.8.0
│   │   ├── textwrap v0.11.0
│   │   │   └── unicode-width v0.1.9
│   │   ├── unicode-width v0.1.9
│   │   └── vec_map v0.8.2
│   ├── lazy_static v1.4.0
│   └── structopt-derive v0.4.18 (proc-macro)
│       ├── heck v0.3.3
│       │   └── unicode-segmentation v1.9.0
│       ├── proc-macro-error v1.0.4
│       │   ├── proc-macro-error-attr v1.0.4 (proc-macro)
│       │   │   ├── proc-macro2 v1.0.40 (*)
│       │   │   └── quote v1.0.20 (*)
│       │   │   [build-dependencies]
│       │   │   └── version_check v0.9.4
│       │   ├── proc-macro2 v1.0.40 (*)
│       │   ├── quote v1.0.20 (*)
│       │   └── syn v1.0.98 (*)
│       │   [build-dependencies]
│       │   └── version_check v0.9.4
│       ├── proc-macro2 v1.0.40 (*)
│       ├── quote v1.0.20 (*)
│       └── syn v1.0.98 (*)
├── strum v0.22.0
├── strum_macros v0.22.0 (proc-macro)
│   ├── heck v0.3.3 (*)
│   ├── proc-macro2 v1.0.40 (*)
│   ├── quote v1.0.20 (*)
│   └── syn v1.0.98 (*)
├── tar v0.4.38
│   ├── filetime v0.2.16
│   │   ├── cfg-if v1.0.0
│   │   └── libc v0.2.132
│   ├── libc v0.2.132
│   └── xattr v0.2.3
│       └── libc v0.2.132
├── uom v0.31.1
│   ├── num-rational v0.3.2
│   │   ├── num-integer v0.1.45 (*)
│   │   └── num-traits v0.2.15 (*)
│   │   [build-dependencies]
│   │   └── autocfg v1.1.0
│   ├── num-traits v0.2.15 (*)
│   ├── serde v1.0.137 (*)
│   └── typenum v1.15.0
├── url v2.2.2
│   ├── form_urlencoded v1.0.1
│   │   ├── matches v0.1.9
│   │   └── percent-encoding v2.1.0
│   ├── idna v0.2.3
│   │   ├── matches v0.1.9
│   │   ├── unicode-bidi v0.3.8
│   │   └── unicode-normalization v0.1.20
│   │       └── tinyvec v1.6.0
│   │           └── tinyvec_macros v0.1.0
│   ├── matches v0.1.9
│   └── percent-encoding v2.1.0
├── uuid v0.8.2
│   ├── getrandom v0.2.7
│   │   ├── cfg-if v1.0.0
│   │   └── libc v0.2.132
│   └── serde v1.0.137 (*)
├── wait-timeout v0.2.0
│   └── libc v0.2.132
├── whoami v1.2.1
├── xdg v2.4.1
│   └── dirs v4.0.0 (*)
└── xmlrpc v0.15.1
    ├── base64 v0.13.0
    ├── iso8601 v0.4.2
    │   └── nom v7.1.1
    │       ├── memchr v2.5.0
    │       └── minimal-lexical v0.2.1
    ├── mime v0.3.16
    ├── reqwest v0.11.11
    │   ├── base64 v0.13.0
    │   ├── bytes v1.1.0
    │   ├── encoding_rs v0.8.31
    │   │   └── cfg-if v1.0.0
    │   ├── futures-core v0.3.21
    │   ├── futures-util v0.3.21
    │   │   ├── futures-core v0.3.21
    │   │   ├── futures-io v0.3.21
    │   │   ├── futures-task v0.3.21
    │   │   ├── memchr v2.5.0
    │   │   ├── pin-project-lite v0.2.9
    │   │   ├── pin-utils v0.1.0
    │   │   └── slab v0.4.6
    │   ├── h2 v0.3.13
    │   │   ├── bytes v1.1.0
    │   │   ├── fnv v1.0.7
    │   │   ├── futures-core v0.3.21
    │   │   ├── futures-sink v0.3.21
    │   │   ├── futures-util v0.3.21 (*)
    │   │   ├── http v0.2.8
    │   │   │   ├── bytes v1.1.0
    │   │   │   ├── fnv v1.0.7
    │   │   │   └── itoa v1.0.2
    │   │   ├── indexmap v1.6.2 (*)
    │   │   ├── slab v0.4.6
    │   │   ├── tokio v1.19.2
    │   │   │   ├── bytes v1.1.0
    │   │   │   ├── libc v0.2.132
    │   │   │   ├── memchr v2.5.0
    │   │   │   ├── mio v0.8.4
    │   │   │   │   ├── libc v0.2.132
    │   │   │   │   └── log v0.4.17 (*)
    │   │   │   ├── num_cpus v1.13.1 (*)
    │   │   │   ├── once_cell v1.13.1
    │   │   │   ├── pin-project-lite v0.2.9
    │   │   │   └── socket2 v0.4.4
    │   │   │       └── libc v0.2.132
    │   │   ├── tokio-util v0.7.3
    │   │   │   ├── bytes v1.1.0
    │   │   │   ├── futures-core v0.3.21
    │   │   │   ├── futures-sink v0.3.21
    │   │   │   ├── pin-project-lite v0.2.9
    │   │   │   ├── tokio v1.19.2 (*)
    │   │   │   └── tracing v0.1.36
    │   │   │       ├── cfg-if v1.0.0
    │   │   │       ├── pin-project-lite v0.2.9
    │   │   │       └── tracing-core v0.1.29
    │   │   │           └── once_cell v1.13.1
    │   │   └── tracing v0.1.36 (*)
    │   ├── http v0.2.8 (*)
    │   ├── http-body v0.4.5
    │   │   ├── bytes v1.1.0
    │   │   ├── http v0.2.8 (*)
    │   │   └── pin-project-lite v0.2.9
    │   ├── hyper v0.14.19
    │   │   ├── bytes v1.1.0
    │   │   ├── futures-channel v0.3.21
    │   │   │   └── futures-core v0.3.21
    │   │   ├── futures-core v0.3.21
    │   │   ├── futures-util v0.3.21 (*)
    │   │   ├── h2 v0.3.13 (*)
    │   │   ├── http v0.2.8 (*)
    │   │   ├── http-body v0.4.5 (*)
    │   │   ├── httparse v1.7.1
    │   │   ├── httpdate v1.0.2
    │   │   ├── itoa v1.0.2
    │   │   ├── pin-project-lite v0.2.9
    │   │   ├── socket2 v0.4.4 (*)
    │   │   ├── tokio v1.19.2 (*)
    │   │   ├── tower-service v0.3.2
    │   │   ├── tracing v0.1.36 (*)
    │   │   └── want v0.3.0
    │   │       ├── log v0.4.17 (*)
    │   │       └── try-lock v0.2.3
    │   ├── hyper-tls v0.5.0
    │   │   ├── bytes v1.1.0
    │   │   ├── hyper v0.14.19 (*)
    │   │   ├── native-tls v0.2.10
    │   │   │   ├── log v0.4.17 (*)
    │   │   │   ├── openssl v0.10.40
    │   │   │   │   ├── bitflags v1.3.2
    │   │   │   │   ├── cfg-if v1.0.0
    │   │   │   │   ├── foreign-types v0.3.2
    │   │   │   │   │   └── foreign-types-shared v0.1.1
    │   │   │   │   ├── libc v0.2.132
    │   │   │   │   ├── once_cell v1.13.1
    │   │   │   │   ├── openssl-macros v0.1.0 (proc-macro)
    │   │   │   │   │   ├── proc-macro2 v1.0.40 (*)
    │   │   │   │   │   ├── quote v1.0.20 (*)
    │   │   │   │   │   └── syn v1.0.98 (*)
    │   │   │   │   └── openssl-sys v0.9.74 (*)
    │   │   │   ├── openssl-probe v0.1.5
    │   │   │   └── openssl-sys v0.9.74 (*)
    │   │   ├── tokio v1.19.2 (*)
    │   │   └── tokio-native-tls v0.3.0
    │   │       ├── native-tls v0.2.10 (*)
    │   │       └── tokio v1.19.2 (*)
    │   ├── ipnet v2.5.0
    │   ├── lazy_static v1.4.0
    │   ├── log v0.4.17 (*)
    │   ├── mime v0.3.16
    │   ├── native-tls v0.2.10 (*)
    │   ├── percent-encoding v2.1.0
    │   ├── pin-project-lite v0.2.9
    │   ├── serde v1.0.137 (*)
    │   ├── serde_urlencoded v0.7.1
    │   │   ├── form_urlencoded v1.0.1 (*)
    │   │   ├── itoa v1.0.2
    │   │   ├── ryu v1.0.10
    │   │   └── serde v1.0.137 (*)
    │   ├── tokio v1.19.2 (*)
    │   ├── tokio-native-tls v0.3.0 (*)
    │   ├── tower-service v0.3.2
    │   └── url v2.2.2 (*)
    └── xml-rs v0.8.4

lelongg avatar Sep 16 '22 16:09 lelongg

@oxalica does https://git.mbosch.me/reproducers/nocargo-repro-issue-10 help?

The issue seems to be related to OS-dependant targets in git dependencies (see https://git.mbosch.me/reproducers/nocargo-repro-issue-10/src/branch/master/Cargo.toml).

Took a brief look with the debugger:

❯ ~/Projects/nocargo-repro-issue-10 master* → nix build -L .\#nocargo-repro --debugger --ignor
e-try
warning: Git tree '/home/ma27/Projects/nocargo-repro-issue-10' is dirty
error: value is a list while a set was expected


Starting REPL to allow you to inspect the current state of the evaluator.

Welcome to Nix 2.16.1. Type :? for help.

nix-repl> :st

0: error: value is a list while a set was expected
0x55d2ba47efe0

    54|       resolvedDependencies =
    55|         map (dep: dep // {
      |                   ^
    56|           resolved = selectDep candidates dep;

Env level 0
static: dep 

Env level 1
static: info id candidates findPkgId resolvedDependencies selectDep 

Env level 2
static: name args version dependencies source 

Env level 3
static: pkgs resolved removeUrlHash pkgsByName resolvePkg 

Env level 4
static: lock 

Env level 5
static: getPkgInfo 

Env level 6
static: preprocess-feature-tests update-feature-tests resolve-feature-tests resolve-deps-tests resolveDepsFromLock resolveFeatures preprocessFeatures enableFeatures 

Env level 7
static: fromTOML readFile toJSON attrNames attrValues listToAttrs mapAttrs elemAt filter elem length foldl' sort substring match concatStringsSep composeManyExtensions filterAttrs flatten optional hasPrefix assertMsg mkPkgInfoFromCargoToml toPkgId sanitizeDep parseSemverReq 

Env level 8
static: self lib 

Env level 9
builtins true false null fromTOML fetchTree fetchTarball fetchGit fetchMercurial scopedImport import isNull break abort throw derivationStrict placeholder baseNameOf dirOf removeAttrs map toString derivation 


nix-repl> dep      
[ { ... } ]

nix-repl> builtins.head dep
{ default_features = true; features = [ ... ]; kind = "normal"; name = "security-framework"; optional = false; package = "security-framework"; req = "2.6"; source = "registry+https://github.com/rust-lang/crates.io-index"; target = "cfg(target_os = \"ios\")"; }

nix-repl> info.dependencies
[ [ ... ] [ ... ] [ ... ] ]

nix-repl> info
{ dependencies = [ ... ]; features = { ... }; isLocalPkg = true; links = null; name = "nocargo-repro"; procMacro = false; src = /nix/store/8cwlj01fzjlk4qx343nfawy5mjg3937j-source; version = "0.1.0"; }

Unfortunately I have a lot of other things ongoing, so I can't really invest the time to do the necessary deep-dive into this (beautiful) project, otherwise I would've investigated further.

Ma27 avatar Jul 09 '23 08:07 Ma27