-
Notifications
You must be signed in to change notification settings - Fork 21
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
Flake #164
Flake #164
Conversation
flake.nix
Outdated
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, haskell-flake-utils, ... }@inputs: | ||
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-darwin" ] (system: |
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.
Why exactly these systems?
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.
Another approach is to use eachDefaultSystem
which is more comprehensive, but I went the route of picking the 2 architectures that I was able to test with.
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'd propose either to use eachDefaultSystem
or all systems we can somehow check on CI.
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'd propose either to use eachDefaultSystem or all systems we can somehow check on CI.
If that's OK, I would ask that we relax that requirement given that aarch64-darwin
(M1 chip) is not available on Github Runners, but that's the machine architecture I'm using.
What I can do is setup a CI matrix for systems that are available in Github that will build x86_64-linux
and x86_64-darwin
(maybe try i686-linux
too).
Note that with this PR haskell-flake-utils
changed their API such that now we pass an array of systems instead of using flake-utils.lib.eachSystem
(which is now called in haskell-flake-utils
).
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.
Can you comment in the readme how to use the flake?
https://github.com/turion/rhine/runs/6568785125?check_suite_focus=true fails with |
Awesome!
Indeed it does.
And it seems it's fixed upstream yesterday 🎉 can you bump
That's good enough for a start :)
Let's see whether the upstream fix works. If yes, keep it, if no, a more manual approach.
Yes makes sense :)
I guess not, it contradicts the previous idea.
I don't care about stack at all, but maybe @miguel-negrao is motivated to fix it 😀
Yes.
I don't know how HLS from the flake interacts with the editor. I'd leave these points out for now.
No idea what that is 😅
Yes, that can be a separate issue.
I prefer smaller blocks. Too big PRs tend to get stuck. |
Sure thing will do. Saw the upstream fix, and will bump it!
There are other concerns, but I'd like to merge this and submit another PR for discussing what other approaches would entail.
I meant the
That's one of the reasons I use flakes and nix :D It works very well, but I agree let's do this in a subsequent PR :)
Should work with this other upstream fix
Sounds good! Thanks a ton for the review, and super excited about your (conceptual) fixes on the |
Great.
Oh, I see! Yes, let's remove those.
Ok, looking forward to that :) |
Hi @turion I think I've addressed all your comments. There are a couple of loose ends. Regarding Also, unfortunately, despite the fix to
This is a known issue and the alternatives are:
Happy to open another issue to figure that one out :) For now I've added a Also I've tested this PR together with #166 and running Cheers, Jun |
Awesome :) two systems built is already great! Let's leave out |
default.nix
Outdated
rhine-examples | ||
; | ||
} | ||
(import ( |
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 think there is a way to detect in a default.nix
whether it is called from nix build
or nix shell
. This could be used to remove shell.nix
completely. But I can't find the option.
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.
If we're ok with requiring a recent version of nix (from 22.05
it's the default, and before this release it just requires setting experimental-features = nix-command flakes
in the nix.conf
), then we actually need neither default.nix
nor shell.nix
which are only here to support legacy nix.
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.
Yes, that's also ok. Let's drop support for legacy nix.
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.
Or rather, I'll leave the choice up to you. Whatever you're more comfortable with.
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.
Looking great :) just some small syntax things.
Uses haskell-flake-utils (experimental) to provide build and devShell with nix flakes: ``` nix build .#rhine-gloss result/bin/rhine-gloss-gears ``` ``` nix develop cabal build rhine ```
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.
Actually this is fine with default.nix
and shell.nix
for now. I'll squash and merge. Thank you very much!
That's great. Will open a new PR for adding haskell language server and look into the multi compiler setup. 👍 |
Hi @turion
Here's a very simple flake (following up on #162) which uses the experimental
haskell-flake-utils
approach which is the only tool I know that simulates someone a simple multi package setup with cabal (it doesn't do anything with thecabal.project
file, instead it takes an argument where we can specify which packages needs to be built).It allows to do
I've tested this on
aarch64
andx86_64-linux
and the added CI job should test building on linux. Though I expect thatnix flake check
will fail with:(I've reported this bug to
haskell-flake-utils
ivanovs-4/haskell-flake-utils#2It builds using GHC 9.0.2 which is the default compiler in nixpkgs stable at the moment. It's not obvious how to build for multiple GHC versions with this utility
Some things to consider moving forward:
haskell-flake-utils
or a more manual approach.flake-compat
for legacy compatibility (as described here)*/shell.nix
and*/default.nix
files.Add local development tooling (HLS, ghcid, hoogle...)for laterAdd a gitpod configuration to be able to have a cloud based development setupfor laterFind a solution for multi compiler buildsfor laterHappy to keep adding to this PR and discuss as we go or merging smaller blocks of work, as you prefer.