-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
build: add flake.nix #533
base: master
Are you sure you want to change the base?
build: add flake.nix #533
Conversation
Thanks @teto. Sadly a majority of maintainers of this project thinks that flakes is an experimental feature and endorsing its use is a footgun for beginners. Imo we can keep this PR open until there is a stable release of nix which supports flakes without experimental flags. |
On further inspection: @teto where did you get the flake template from? It seems riddled with design decisions that seem very opinionated and overcomplicated. Templates like these are a reason why nix beginners get overwhelmed. |
Right now there is neither a shell.nix or a flake.nix which is strange for a nix project. I've added a shell.nix via the flake-compat layer. Could you be more precise about what you would do differently ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two problems with this:
- The flakes' lock file needs to be continuously updated.
- This repository is not very high velocity, so a lock file will quickly become outdated compared to upstream nixpkgs.
- No one with commit access actively uses flakes, so it's unlikely the lock file would be updated at all.
- We only need a shell.nix basically, I specifically do not want anyone to use cabal2nix via flakes from this repository. cabal2nix in nixpkgs is updated and maintained and should be used consequently.
Experimental Nix users can still rely on nix-shell
, whereas using flake-compat just adds extra wait time for all others for a simple shell.nix.
For the sake of completeness a few extra remarks below.
}; | ||
|
||
in { | ||
packages = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want a flake, if any, to expose a cabal2nix package. The supported and maintained ways to get cabal2nix are hackage and nixpkgs. If you want something closer to HEAD, use haskellPackages.cabal2nix-unstable
or override it yourself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like having the possibility to build in a sandbox from scratch (i.e. more powerful than what cabal does). It helps me check it really works. Could be useful in a CI too.
I can remove it if you dont like it.
I thought pinning was a desired property of nix to allow for reproducibility ? flakes make it easier than the rest (no niv or tofu, it's builtin). you can even override the version on the CLI in a standardized way via
If no one is using it than not a problem if it's not up to date ? pinning is good since you guarantee it works.
what if you want to develop on it ? You need some extras like cabal etc. That's the power of nix and its per-project shell.nix.
so there is no shell.nix, I provide one and doing so I delay the time before one becomes available ? Sorry I dont get the logic. Someone can update the shell.nix with a hardcoded version later. |
run `nix develop` to get a development environment
Not to put the burden on @teto, but wanted to check in with the maintainers on the current stance. Flakes gained a lot of maturity since December 2021, and while I don't think they are marked as stable just yet https://github.com/cargo2nix/cargo2nix doesn't seem to be having too many problems because of it. And I believe https://github.com/srid/haskell-flake also appeared since then. Concretely, what would be needed from flakes to get included in caba2nix? Not marked as stable? Or perhaps something else? |
@liesnikov Oppositely, what is your use-case that you'd really like us to adopt a |
At the moment I most definitely am getting it from nixpkgs. My arguments would probably fall along the same lines as what @teto mentioned above with one addition that having a cabal2nix flake would allow for a more organic pinning of cabal2nix version without the need to explicitly bring a new nixpkgs intro the scope. Perhaps it's worth saying that I don't really think any of this is too specific to cabal2nix and until now it's been a great help the way it is (thanks to the maintainters!). |
This is a development repository. You can obtain a well-tested and stable version of cabal2nix alongside useful tools like |
@liesnikov To add to what @sternenseemann is saying, as far as I am aware, a flake.nix will allow you to pin arbitrary git repos (i.e. non-flake inputs), right?
What would having a flake.nix in this repo get you that just pinning the |
run
nix develop
to get a development environment