hledger
hledger copied to clipboard
Provide Nix Flake
It would be quite useful for some situations (especially CI runners and comparing differences between processing a project an Different hledger versions) if there was a Flake provided in this repository with a lock file updated and tested to be working on each release. This would enable running any arbitrary version of hledger (at least ones post-dating introduction of the Flake!) with a simple command like nix run gihub:simonmichael/hledger.
We need a resident Nix packager - interested ?
I'd help, but I not familiar with how Nix handles Haskell in general. I kind of have a handle on it's Autotools and Lua stuff and am getting acquainted with Rust packaging, but Haskell is not my forte.
As a side note the nixpkgs packaging for hledger is pretty out of date too.
I can look into it
Thanks! We probably need to update or drop the Nix install method at https://hledger.org/install.html#other too.
I'd say they need updating not dropping. I don't know what the use of the archive hard coded version is about there, but before I even opened this issue I was playing around with it and an invocation as simple as nix run nixpkgs#hledger worked just fine. I assume that archive much be at attempt to get a newer version that isn't released yet, but the best think to do is probably to chase down why it isn't updated in the first place and just recommend the normal ecosystem commands: nix-env --install hledger or something basic like that if what you wanted was to suggest the way to drop into a shell with hledger available. The archive version being referenced isn't fresh anyway.
From reviewing nixpkgs issues and asking around Arch packagers why hledger is out of date there too it seems the answer is everybody is having trouble dealing with GHC/Stack updates: either they can't update the compilers because some things don't compile or have updated them and some things don't compile.
Specifically for Arch, hledger-iadd not building on GHC 9 appears to be the hold up for also updating the Hledger package. That's also what inspired this PR.
For Nix I'm not so sure on details of what is holding up what, but
The haskell packages in nixpkgs follow stackage LTS releases, AFAIK.
The Install page's nix command is simply a reliable one-line install command, like we have for the other platforms. This one worked in the past, and I update it occasionally, but it's not easy for me to test, and I know it's not a typical nix workflow.
I'm sorry for forgetting our existing Nix packager, @maralorn. I'm keeping better track now.
- If someone else maintains it, a
flake.nixin the hledger repo is fine by me. (I can of course help/give feedback, if that’s desired.) It would be duplicating effort to nixpkgs, where we already maintain a working hledger build. It might be helpful to have it for certain usecases, especially for an easy dev environment. - The user guide should encourage Nix(OS) users to install hledger from nixpkgs. That is the purpose of a distribution, and it is less overhead and easier to maintain for the user.
- If people desire the default hledger version in nixpkgs to be more up-to-date, that can definitely be done. (Especially if hledger commits to stay compatible with stackage LTS.) Up to now, I didn’t bother to break from our default, because no-one asked for it.
- The usecase given in the motivation of this issue can also be achieved via nixpkgs. There is quite certainly for every hledger release a nixpkgs version which ships it, but I admit that for usecases like bisection the flake.nix in this repo might be a bit easier.
- As the issue states, a flake in this repo is only helpful if the flake is maintained and regularly tested, ideally by hledger ci.
Thanks maralorn. I'm not a nix user, but I think clearly we'd like to have each new release installable as easily and promptly as possible, as on all other platforms.
Clarifying: as we wish for on other platforms. hledger is not as fresh as we'd like in many places.
Thanks maralorn. I'm not a nix user, but I think clearly we'd like to have each new release installable as easily and promptly as possible, as on all other platforms.
I will put that on my todolist.
@maralorn Quick Q if you don't mind. Is it possible to evoke hledger binary using the hledger_1_30_1 derivation in Nixpkgs' hackage-packages.nix from a shell? If so what's the magic incantation?
@alerque You should be able to use a command like the following:
$ nix-shell -p haskellPackages.hledger_1_30_1
This works on Nixpkgs master right now, commit 8c9caf3387b4.
Nixpkgs provides a top-level attribute haskellPackages that contains all the derivations from hackage-packages.nix.
(However, in practice, the foobar_1_2_3_4 derivations are not guaranteed to be working. While it looks like hledger_1_30_1 is currently working, there is no guarantee that this will continue to work into the future. You're much more likely to find success with the derivations that don't have a _1_2_3_4 version in their name.)
Thanks, that top level attribute mapping was exactly what I surmised existed but couldn't put my finger on.
Another release cycle rolls around and not having a Flake makes it so much harder to transition projects to use new features :crying_cat_face: …
If someone else maintains it, a flake.nix in the hledger repo is fine by me.
Anyone interested in maintainining a flake ?
Would it help in ensuring a fresher hledger for folks like https://fosstodon.org/@nobodyinperson/111510458430760014 ?
@simonmichael Well that person seems happy about the version they get from nixpkgs. They could maybe get an even newer version from the flake, but that toot doesn‘t look like they are asking for that. It is also slightly more hazzle for the user.
I still plan to try to provide a hledger in nixpkgs that is newer than stackage LTS, but no one got around to it.
I'd be happy to help maintain such a flake, but maintaining it requires a bit less Haskell & Nix chops than getting it spun up in the first place. I would do that too if I could. The pandoc project has somewhat recently gotten a flake running, so that's a promising possibility as a template to follow that didn't exist since the last time I looked for something to get me started. I'm familiar with setting up Flakes for Rust and Lua and a few other environments, just not Haskell.
Fresher builds in Nixpkgs would help some and be nice for other reasons too, but would not cover all the use cases a flake would.