Skip to content

Replace cargo2nix with Crane and optimize Flake#63

Open
lafrenierejm wants to merge 1 commit into
elizagamedev:mainfrom
lafrenierejm:crane
Open

Replace cargo2nix with Crane and optimize Flake#63
lafrenierejm wants to merge 1 commit into
elizagamedev:mainfrom
lafrenierejm:crane

Conversation

@lafrenierejm

Copy link
Copy Markdown

Crane obsoletes the need for Cargo.nix by parsing dependencies directly from Cargo.lock and improves build times by building and caching dependencies as their own Nix derivation.

Comment thread .envrc
use nix
if command -v nix &>/dev/null; then
use flake
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think direnv already does the check when setting use flake ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I last tested it multiple months ago, direnv would fail if it didn't have the flake module loaded and I omitted the command check. It's definitely possible that has changed in recent versions of direnv, though; feel free to send a link to a changelog entry or commit and I'll gladly simplify this.

Comment thread flake.nix Outdated
Comment thread flake.nix
inputs.nixpkgs.follows = "nixpkgs";
};
advisory-db = {
url = "github:rustsec/advisory-db";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that to check for vunerabilities ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it provides a way to audit dependencies for vulnerabilities via https://rustsec.org/.

@teto

teto commented Nov 21, 2024

Copy link
Copy Markdown

I dont know what is the best now for nix + rust. I think I used crane for another package. Per package caching sounds nice, and the removal of Cargo.nix is awesome too. I think I approve but I am not maintainer on the repo.

@teto

teto commented Nov 21, 2024

Copy link
Copy Markdown

@lafrenierejm would you like to become a maintainer ? maybe @elizagamedev could give you access if positive ?

Crane obsoletes the need for `Cargo.nix` by parsing dependencies directly from
`Cargo.lock` and improves build times by building and caching dependencies as
their own Nix derivation.
@lafrenierejm

Copy link
Copy Markdown
Author

would you like to become a maintainer ?

@teto I would be glad to help maintain this project. The call is entirely @elizagamedev's, though.

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