garden-rs / garden

Garden grows and cultivates collections of Git trees ~ Official mirror of https://gitlab.com/garden-rs/garden
https://garden-rs.gitlab.io
MIT License
66 stars 9 forks source link

Packaged for Nix #16

Closed nickgarber closed 10 months ago

nickgarber commented 1 year ago

Hello!

Would you be open to adding (or reviewing a PR for) the ability to install Garden as a Nix package?

If so, I'd be interested in contributing this or assisting with it.

It's possible and useful to make garden installable via Nix by adding a single (flake.nix) file to the root of this repo.

[1] https://nix-tutorial.gitlabpages.inria.fr/nix-tutorial/first-package.html

davvid commented 1 year ago

Adding a flake.nix would be really nice! Thanks for the offer.

I need to start using nix as well. #17 sounds super intriguing, so I'd be in favor of it but I don't have enough nix experience to know where to start going with it.

If there are garden features that make it easier to accomplish the integration then I'm all ears. Anyways, just saying that I'm very much in favor of nix-related topics.

firestack commented 1 year ago

I've gotten this building via crane if you're interested in that approach https://github.com/firestack/garden-rs.nix

I didn't look into why the read_grafts test was failing yet, so I disabled checks.

davvid commented 1 year ago

Thanks @firestack that's really cool. As a non-nix user, what would be the best way to adopt the nix packaging into this repo if we wanted to maintain it in-tree?

I noticed a few flake = false settings in the flakes file -- I'm assuming that's related to our repo not providing a flakes.nix file.

I'd be more than happy to merge a PR that adds a nix file to the repo if you're down to help maintain it and give me some guidance on what the installation instructions should look like in the documentation.

Let me know if there's anything more I can do to help.

And, yeah, sorry that I haven't had a chance to install or experiment with nix so I'm pretty unfamiliar with the tooling and nix dev workflow for upstream authors.

nickgarber commented 1 year ago

Just a supportive note to add that we'll all still learning :)

I've also previously created nix packaging using https://github.com/nix-community/nix-init but felt uncertain about recommending it for PR.

As an incremental step, may we use an medium/long running feature branch for nix packaging? That way it's visible and iterable but without all the implicit guarantees of polish that a merged-to-main PR might suggest.

Thanks @firestack, @davvid !

firestack commented 1 year ago

As a non-nix user, what would be the best way to adopt the nix packaging into this repo if we wanted to maintain it in-tree?

I can open a PR to add it and we can collaborate from there, limited free-time etc etc.

If we use flakes (a hot topic in the community) we'd need to add a flake.nix and flake.lock. If we wanted to make it esier for non-flakes users, without PR-ing something to nixpkgs, that would involve adding additional nix files, such as default.nix or maybe garden.nix, and importing those in the flake. I haven't tried building without crane, mostly because it's the easiest I've found and my preferred way to get rust projects building with nix flakes. I'm not sure if/how crane supports non-flakes users, so if that was a requirement we'd potentially need to change the way it's currently built.

@nickgarber do you have any preferences on flakes?


I noticed a few flake = false settings in the flakes file -- I'm assuming that's related to our repo not providing a flakes.nix file.

Yes, this tells nix not to check for a flake.nix file in the input.


Let me know if there's anything more I can do to help.

One thing that does come to mind is investigating how to make sure test's work correctly in nix. I think it's mostly straightforward, but just something to keep in mind for when there's a PR.

nickgarber commented 1 year ago

I heavily and happily pro-flakes in my own work :D

but also very aware that large swathes of this subject matter are new to me.

Hoping to help and eager to learn!

davvid commented 10 months ago

I got the test suite working in nix. It was mostly a matter of making *.yaml and *.sh files available for the test suite. crane's filterCargoSources doesn't include them by default.

I'll be pushing up commits shortly that resolve this issue but I'm still down for further tweaks and enhancements from more experienced nix users.