-
-
Notifications
You must be signed in to change notification settings - Fork 140
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 flake #1575
base: master
Are you sure you want to change the base?
Add nix flake #1575
Conversation
@thomas-zahner, @niklaskorz, any thoughts? |
@tirimia Did you see #1565? It's pretty much a duplicate of this PR. The main difference is that with my PR I didn't have Is it possible to easily specify the Rust version in this flake? If not I would probably prefer my approach. |
That’s the beauty of using the fenix flake and reading the toolchain configuration, that’s already taken care of and we then also know we provision rust like the non-nix users of the repo 🥳 In general though, I personally avoid thinking of the specific version of software when working with nix as it’s rolling release and if I need something specific, importing a pinned version of nixpkgs is still an open option. A further advantage of this PR is that people can reference this flake and use lychee without having to figure out how to build it on their own. You can also directly call it with |
@tirimia Ah I see, thanks for the clarification. I agree that this is probably the better approach. Does this mean that nixpkgs could simply reference our flake? |
Also would you mind if we add an |
Nixpkgs offers a reference to its packages via flakes as a convenience; flakes are not “officially” stable. You can, however, reference this flake in your own or in the command line |
I would avoid that. Direnv docs recommend you add .envrc and .direnv to your global git ignore. Committing it forces people to use the flake if they use direnv, and it also prevents people from having their own configuration As for the “stupid” questions: nix is a beast, the craft of tech is impossible to master in its entirety. Don’t judge yourself for not knowing things, enjoy that you get to learn 💃 |
As for |
Co-authored-by: Niklas Korz <[email protected]>
@tirimia @niklaskorz thank you for the answers and improvements. The flake now targets my platform but it still does not build because of the pinned SHA which is not the same on my platform. With the current version I get a mismatch: We can't simply remove the argument because it seems to be required: When an empty string is provided or if
So now I see two possibilities:
|
Oops, I was not aware that would happen, so sorry 😭 Pushing a new version that uses crane (better for incremental builds), also getting read of flake-utils since it's not necessary Also, since the rust-toolchain only wants |
That's no problem. Ah, that's interesting. Could you elaborate what the advantages of crane are? I'm I understanding it correctly that the dependencies are now fetched with Nix instead of cargo? Crane seems to be quite slow.
When I would use crane as developer how would I use clippy and rust-analyzer? If you take a look at my PR you can see that I also include clippy and rust-analyzer explicitly because as a developer I definitely also want to make use of these tools. |
Well that's really weird if it doesn't fail on your side, isn't the whole point of what we try to achieve reproducibility 😅 I think all of the failing tests do some real HTTP calls so this might be a clue. For testing I've also set both Here's the end of the full error message, maybe it helps?
|
@tirimia Also thanks for the clarification. I think we have two use cases: building the project and a practical/useful dev shell. For me personally the dev part is more important. But of course it would be awesome if we could also build with Nix, so that in the long run we might even use Nix in CI. If you know what the problem is, it would be great if you could fix the build issue. But since you don't seem to be able to reproduce it that might be hard.. If we did manage to fix that, then I would also like to add the programs previously mentioned and add the But otherwise I'd like to merge my PR. I think it should also be possible to update my PR so that |
We can for sure get your PR working cross-platform, all we need there is to add "aarch64-darwin" to the systems and most devs will be covered; if we go with that approach, I do have to urge you to reconsider checking in the With regards to the |
This PR enables building lychee via nix flake by simply running
nix build
.Simultaneously,
nix develop
will open a shell with the environment required to build and develop it.