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

add(nix): add crate2nix #1181

Merged
merged 2 commits into from
Mar 6, 2022
Merged

add(nix): add crate2nix #1181

merged 2 commits into from
Mar 6, 2022

Conversation

a-kenji
Copy link
Contributor

@a-kenji a-kenji commented Mar 5, 2022

To have a better experience on ci, due to improved caching
of dependencies. Also organize file hierarchy slightly.

To have a better experience on ci, due to improved caching
of dependencies. Also organize file hierarchy slightly.
@colemickens
Copy link

Just a note: helix uses nix-cargo-integration which leverages dream2nix which seems to have a lot of new enthusiasm. Of note, it's actually been a small issue for me, though soon to be fixed: helix-editor/helix#1757 (again though, I'm not sure how crate2nix handles this particular case).

I have no idea which is better, just wanted to mention it.

@colemickens
Copy link

(The error I just mentioned actually looks a lot like the eval error this PR build just hit.)

@colemickens
Copy link

And same for me:

❯ nix build \
    --eval-store auto \
    --store 'ssh-ng://[email protected]' \
    github:zellij-org/zellij/934939c0e68c35b0f82130d64ead3b02b4e82ee2

warning: error: SQLite database '/nix/var/nix/db/db.sqlite' is busy
error: a 'x86_64-linux' with features {} is required to build '/nix/store/jlhp550ybd3y8smlprsay0za4jz7psqm-addr2line-0.15.2.tar.gz.drv', but I am a 'aarch64-linux' with features {benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test}

@a-kenji
Copy link
Contributor Author

a-kenji commented Mar 5, 2022

Just a note: helix uses nix-cargo-integration which leverages dream2nix which seems to have a lot of new enthusiasm. Of note, it's actually been a small issue for me, though soon to be fixed: helix-editor/helix#1757 (again though, I'm not sure how crate2nix handles this particular case).

I have no idea which is better, just wanted to mention it.

Thank you, this is really good input.
I am also trying to improve cross compilation, still having trouble building the plugins in a flake.

I will definitely try out dream2nix, the issue you posted, shows a person that raised of few valid pain points I had in the crate2nix repo. So I am double interested!

@a-kenji
Copy link
Contributor Author

a-kenji commented Mar 5, 2022

And same for me:

❯ nix build \
    --eval-store auto \
    --store 'ssh-ng://[email protected]' \
    github:zellij-org/zellij/934939c0e68c35b0f82130d64ead3b02b4e82ee2

warning: error: SQLite database '/nix/var/nix/db/db.sqlite' is busy
error: a 'x86_64-linux' with features {} is required to build '/nix/store/jlhp550ybd3y8smlprsay0za4jz7psqm-addr2line-0.15.2.tar.gz.drv', but I am a 'aarch64-linux' with features {benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test}

Thanks! Yeah, because of the IFD it still errors out, I seem to always forget that.

Is needed because `nix flake check` accidentally tries to build IFD.
@a-kenji
Copy link
Contributor Author

a-kenji commented Mar 5, 2022

And same for me:

❯ nix build \
    --eval-store auto \
    --store 'ssh-ng://[email protected]' \
    github:zellij-org/zellij/934939c0e68c35b0f82130d64ead3b02b4e82ee2

warning: error: SQLite database '/nix/var/nix/db/db.sqlite' is busy
error: a 'x86_64-linux' with features {} is required to build '/nix/store/jlhp550ybd3y8smlprsay0za4jz7psqm-addr2line-0.15.2.tar.gz.drv', but I am a 'aarch64-linux' with features {benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test}

@colemickens,
Can you build the nix build .#zellij-native package?

@colemickens
Copy link

Looks ok:

zjrev="407d251272e086a45110069233bab691cea48367"

❯ nix copy \
    --eval-store auto \
    --from 'ssh-ng://[email protected]' \
    --to "ssh-ng://cole@$(tailscale ip --6 rpifour1)" \
    --no-check-sigs \
    "github:zellij-org/zellij/${zjrev}#packages.aarch64-linux.zellij-native"

❯ ssh cole@$(tailscale ip --6 rpifour1) \
    nix run "github:zellij-org/zellij/${zj}#packages.aarch64-linux.zellij-native" \
      -- --version
zellij 0.26.0

ignoring the version, looks like it works.

(I thought I opened an issue for the version somewhere, maybe it was Matrix -- I assume zellij uses claps crate_version which takes version directly from the Cargo.toml... which can't really be re-written easily since you have to re-generate the lock. Options for fixing include maybe manually implementing --version or I think I've also seen a build.rs that replaces CARGO_PKG_VERSION with some other env var.)

@a-kenji
Copy link
Contributor Author

a-kenji commented Mar 6, 2022

Thank you for checking!

ignoring the version, looks like it works.

The version is correct, at least from our standpoint.
The main version is the version that will get released as v0.26, so if you build post release of v0.25 from main you will build a v0.26.

I assume zellij uses claps crate_version which takes version directly from the Cargo.toml... which can't really be re-written easily since you have to re-generate the lock. Options for fixing include maybe manually implementing --version or I think I've also seen a build.rs that replaces CARGO_PKG_VERSION with some other env var.)

Yes, Ideally I would like to improve the version number
and also include the hash on non release commits.

@a-kenji
Copy link
Contributor Author

a-kenji commented Mar 6, 2022

I will merge this for now,
I will keep looking into nix-cargo-integration,
I don't really like most of it's ergonomics yet, but I very much like how they are building the crates.

@a-kenji a-kenji merged commit f5ae10d into zellij-org:main Mar 6, 2022
@a-kenji a-kenji deleted the refactor-nix branch March 6, 2022 13:28
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

Successfully merging this pull request may close these issues.

2 participants