gitu icon indicating copy to clipboard operation
gitu copied to clipboard

Nix flake and/or package

Open t56k opened this issue 1 year ago • 10 comments

Any interest in packaging this in a Nix flake and/or package? It would make it much easier than toolchaining Rust.

t56k avatar Mar 11 '24 21:03 t56k

Most definitely. I'm unfamiliar with Nix myself though.

altsem avatar Mar 11 '24 21:03 altsem

I've made a flake here that builds on NixOS nicely--happy to run some tests on macOS too (and/or submit a PR).

t56k avatar Mar 12 '24 02:03 t56k

Sweet, saw the PR, will have a look at it when I can.

I suppose I need an account somewhere to publish it? How does it work?

If anyone else into nix reads this, I'd appreciate if you had a look at the PR too :)

altsem avatar Mar 12 '24 11:03 altsem

You just need to publish the flake.nix on the root of the repo, so no extra accounts are needed. But I think flakes are best paired with a binary cache, so that end users don't have to locally build the program.

A popular option for this is Cachix. It's free for open-source projects, but you do need to register an account. There's this tutorial on setting up a GitHub CI for it. There's also this workflow from Helix for reference. For the workflow to work, you need to store the CACHIX_AUTH_TOKEN secret you get after registering your project on Cachix.

I could make a separate PR for it, if it can't just be added to the one above. But really, you can just copy-paste Helix's workflow above and %s/helix/gitu (or the name you registered on Cachix).

musjj avatar Mar 12 '24 11:03 musjj

@musjj thanks for the input, I'll give it a shot when this is merged

altsem avatar Mar 12 '24 22:03 altsem

I already started maintaining the upstream package in nixpkgs

a flake could still be useful for local development however

evanrichter avatar Mar 12 '24 22:03 evanrichter

I guess another advantage of flakes is less delay between commit to package available

evanrichter avatar Mar 12 '24 22:03 evanrichter

Nice! I take it the caching is less of an issue when developing locally

altsem avatar Mar 12 '24 22:03 altsem

Nice! I take it the caching is less of an issue when developing locally

The flake will cache dependencies locally--and build from master on update instead of waiting for nixpkgs. Both have their advantages.

Keep in mind that my flake hasn't been tested on macOS yet, aiming to get that done shortly--unless someone just wants to run some tests and/or probably just add darwin.apple_sdk.frameworks.Security to the darwin-only buildInputs.

t56k avatar Mar 12 '24 23:03 t56k

Nice! I take it the caching is less of an issue when developing locally

The flake will cache dependencies locally--and build from master on update instead of waiting for nixpkgs. Both have their advantages.

Keep in mind that my flake hasn't been tested on macOS yet, aiming to get that done shortly--unless someone just wants to run some tests and/or probably just add darwin.apple_sdk.frameworks.Security to the darwin-only buildInputs.

Updated with Security and libiconv to build on macOS.

t56k avatar Mar 13 '24 00:03 t56k