-
-
Notifications
You must be signed in to change notification settings - Fork 378
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
nix: refactor with flakes #1827
Conversation
Hmm, I found in order to make |
I want to remark that flakes is still an experimental feature. Users will need to enable experimental features to be able to use this. Besides that I can‘t follow your concerns in the mention. Why does the switch to flakes change your needs to override/fix stuff? |
Because I want to make use of the output schema |
Ah, okay, I understand. Yes, this is a general issue, where package maintenance in nixpkgs duplicates efforts for every project that has it’s own default.nix. I am kind of hoping that once we have nix-in-nix it might emerge a new pattern where nixpkgs can delegate the package description to the upstream package. But I am not sure that it’s a) a good idea and b) will ever happen. |
How difficult is it to support customising the GHC version? Even if it is not convenient, sometimes it is necessary in order to fix compatibility issues |
The structure of flake (eliding x86_64-darwin):
Building (installation)Derivations that build HLS are exported to
Developing
NoticeIIRC, hydra builds only the default GHC version of Haskell packages set, so you may have to build many Haskell dependencies manually if you don't use the default version. (We can do this in GitHub actions, and push it into cachix, but I don't know whether it is worth) Besides cloning this repo and using the commands shown above, a Haskell project based on flakes can add this flake as input, obtaining the latest unreleased version of HLS in developing. This could be an alternative installation method (#122 discussed about nix installations). |
We currently build 884, 8104 and 901 on hydra, also we build (or rather try to build in the case of ghc9) hls for all of those. So actually you should get great caching for these builds. |
Could you record these instructions in the |
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.
LGTM :)
@@ -24,7 +24,6 @@ jobs: | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
ghc: ['default'] |
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.
Branch protection rules need to be updated
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.
Done
Flakes are the new feature of nix package manager that solves pain points of pinning nix dependencies and makes nix parts more composable. Recently, pre-commit-hooks.nix adds flake supports, but now we use it via
builtins.fetchTarball
, which is not good for maintenance. Currently we use niv to manage nix dependencies, but the generated files and inconsistency are annoying. So I think it's time to migrate to flakes. New commands:nix flake update
- update all nix dependenciesnix develop
- start a HLS development environment, like the legacynix-shell
nix build
- build HLS withoutcabal-install
nix run
- run HLS executableIf a downstream package using flakes wants to include HLS to its dev shell, it can directly add
"github:haskell/haskell-language-server"
to theinputs
, and the latest git version of HLS will be available.I keep only the support of the default GHC version in nixpkgs, because I don't think people will use other GHC versions to develop HLS with nix - not using binary caches is painful. I also add flake-compat to make legacy
shell.nix
still available.Now running
nix flake check
ornix flake show
will cause the evaluation of each system's expression, so I got :on my NixOS machine, which will not affect the development, but I don't know where the problem is, and I'd appreciate if anyone could help...
UPDATE: I think the working principle of
callCabal2nix
might have some problems with flakes, and other Haskell projects using flakes seem to have the similar issue as well.