feat: add nix flake to package for NixOS
I added a Nix flake to package the LibreVNA-GUI for NixOS users.
Hi, thank you for the PR. I am unfamiliar with NixOS and flake. Could you please explain why this is needed, how installation would work on NixOS and whether the files have to be at the root of the repository? (I would rather prefer adding a folder for packaging instead of cluttering root)
This has been stale for a while. Any chance you can answer my questions? I am not against merging this, but would need to understand a bit more about it
Hi, apologies for my late response
Nix is a package management system based on Nix's functional programming language. You can find many resources about it online and from their official website. NixOS is not as user-friendly as distributions such as Ubuntu, but once you overcome the learning curve, it is hard to use any other distribution.
Ideally, we should submit the package to nixpkgs to include it in Nix distribution. (I didn't due to unfamiliarity with the community and lack of time, but I will do at some point). The next best thing is to include a flake for Nix users.
Now for why it has to be in the root, it doesn't have to be, but having it at the root of the repo is more convenient.
Here are some possibilities:
At root of a branch
In my fork of LibreVNA, I have a branch called nixos-support where flake.nix and flake.lock are present at the root of the repository. Anyone with Nix can run the following command to build and run LibreVNA-GUI:
nix run github:mtahernia/LibreVNA/nixos-support
This will pull the repo and build it and run the software. (also can install with nix,...)
At root of the main branch
If the files were in the main branch, you can omit the branch and simply run
nix run github:jankae/LibreVNA
In the subdirectory of a branch
They can also be in a subdirectory. Imagine flake.nix and flake.lock are located in package/nix of a branch test_branch; then one can use the following:
nix run github:jankae/LibreVNA/test_branch?dir=package/nix
In a separate repo containing only the flake.nix and flake.lock
nix run github:jankae/LibreVNA-nix
I hope this answers your question. Many thanks for your incredible work :)
Ideally, we should submit the package to nixpkgs to include it in Nix distribution. (I didn't due to unfamiliarity with the community and lack of time, but I will do at some point).
I don't maintain any C++ packages on nixpkgs, but I do maintain a couple others. I think that it would make sense to open a PR there. I can offer some review at least.
It would also be okay to simultaneously have a flake here, but if jankae is unfamiliar with it, it may become a maintenance burden as the project evolves, unless a contributor offers help maintaining the flake of course!
I am still unfamiliar with it and already pretty busy with maintaining the rest of this project. I'll go ahead and close this one. If someone wants to take on the responsibility of maintaining the Nix flake, I am happy to reopen this.
Apologies for necromancing this issue, but just FYI, I have create a PR to get the LibreVNA-GUI into nixpkgs, so users will be able to just run/install the latest release from there: https://github.com/NixOS/nixpkgs/pull/446590.