hercules-ci / gitignore.nix

Nix functions for filtering local git sources
The Unlicense
245 stars 20 forks source link

gitignore.nix breaks crate2nix (Rust) #51

Open srid opened 3 years ago

srid commented 3 years ago

Perhaps a warning is worth adding to the README?

Details: https://www.reddit.com/r/rust/comments/mmbfnj/nixifying_a_rust_project/gtsgxal/?utm_source=reddit&utm_medium=web2x&context=3

roberth commented 3 years ago

Do you have the error message at hand? Perhaps it can be fixed.

srid commented 3 years ago

The error can be reproduced by using a particular (pre-revert) commit from https://github.com/soywod/himalaya/pull/73

❯ nix run github:srid/himalaya/a267f6b876b938605e583147cf311ec5baa7a4b2
error: builder for '/nix/store/vqyq9brra8qmn6yq0jvy7ssn18zhs7cq-himalaya-crate2nix.drv' failed with exit code 3;
       last 10 log lines:
       > -rw-r--r-- 1 nixbld nixbld  1571 Jan  1  1970 LICENSE
       > -rw-r--r-- 1 nixbld nixbld  8240 Jan  1  1970 README.md
       > -rw-r--r-- 1 nixbld nixbld   480 Jan  1  1970 default.nix
       > -rw-r--r-- 1 nixbld nixbld  2489 Jan  1  1970 flake.lock
       > -rw-r--r-- 1 nixbld nixbld  1922 Jan  1  1970 flake.nix
       > -rw-r--r-- 1 nixbld nixbld   764 Jan  1  1970 install.sh
       > -rw-r--r-- 1 nixbld nixbld   453 Jan  1  1970 shell.nix
       > drwxr-xr-x 8 nixbld nixbld  4096 Jan  1  1970 src
       > drwxr-xr-x 7 nixbld nixbld  4096 Jan  1  1970 vim
       > == ls -la (END)
       For full logs, run 'nix log /nix/store/vqyq9brra8qmn6yq0jvy7ssn18zhs7cq-himalaya-crate2nix.drv'.
(use '--show-trace' to show detailed location information)

and

❯ nix log /nix/store/vqyq9brra8qmn6yq0jvy7ssn18zhs7cq-himalaya-crate2nix.drv
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/bnlp2br14mh3z7wv0kagkk8jxlvrvbhb-source
source root is source
@nix { "action": "setPhase", "phase": "buildPhase" }
building
++ crate2nix generate -f ./Cargo.toml -o Cargo-generated.nix -h /nix/store/nzvk2yxgmcz0jkzpwsgl4wpvq43646pr-himalaya-crate2nix/crate-hashes.json
Error: while retrieving metadata about ./Cargo.toml: Error during execution of `cargo metadata`: error: no matching package named `clap` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
required by package `himalaya v0.2.2 (/build/source)`

crate2nix failed.
== cargo/config (BEGIN)
    [source.crates-io]
    replace-with = "vendored-sources"

    [source.vendored-sources]
    directory = "/nix/store/y1qfdpg2anpsvh321yr97sph54hdxwis-deps"

== cargo/config (END)

== crate-hashes.json (BEGIN)
    {}
== crate-hashes.json (END)

== ls -la (BEGIN)
total 108
drwxr-xr-x 6 nixbld nixbld  4096 Jan  1  1970 .
drwx------ 3 nixbld nixbld  4096 Apr  8 13:28 ..
drwxr-xr-x 3 nixbld nixbld  4096 Jan  1  1970 .github
-rw-r--r-- 1 nixbld nixbld    30 Jan  1  1970 .gitignore
-rw-r--r-- 1 nixbld nixbld    79 Jan  1  1970 .gitmodules
drwxr-xr-x 2 nixbld nixbld  4096 Jan  1  1970 .vscode
-rw-r--r-- 1 nixbld nixbld  3672 Jan  1  1970 CHANGELOG.md
-rw-r--r-- 1 nixbld nixbld 32251 Jan  1  1970 Cargo.lock
-rw-r--r-- 1 nixbld nixbld   576 Jan  1  1970 Cargo.toml
-rw-r--r-- 1 nixbld nixbld  1571 Jan  1  1970 LICENSE
-rw-r--r-- 1 nixbld nixbld  8240 Jan  1  1970 README.md
-rw-r--r-- 1 nixbld nixbld   480 Jan  1  1970 default.nix
-rw-r--r-- 1 nixbld nixbld  2489 Jan  1  1970 flake.lock
-rw-r--r-- 1 nixbld nixbld  1922 Jan  1  1970 flake.nix
-rw-r--r-- 1 nixbld nixbld   764 Jan  1  1970 install.sh
-rw-r--r-- 1 nixbld nixbld   453 Jan  1  1970 shell.nix
drwxr-xr-x 8 nixbld nixbld  4096 Jan  1  1970 src
drwxr-xr-x 7 nixbld nixbld  4096 Jan  1  1970 vim
== ls -la (END)
srid commented 3 years ago

Also worth noting that this happens only when the git working copy is not dirty.