Use nix-haskell and provide source-repository-packages to Cabal in shell
#1
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "nix-haskell"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
nix-haskelland providesource-repository-packages to Cabal in shell c228354a13@ -6,0 +3,4 @@nix-haskell.url = "github:reflex-frp/nix-haskell";hls-src = { url = "github:haskell/haskell-language-server/2.13.0.0"; flake = false; };hs-bindgen-src = { url = "github:well-typed/hs-bindgen/6ca94188abd756a1fb4dd8a4037de3fa7dca0765"; flake = false; };libclang-src = { url = "github:well-typed/libclang/d6e482df49b88375cf3075928a78ee86c2a068d4"; flake = false; };Matching to old
cabal.projectfor now, but we should probably just letflake.lockdo the pinning. Main thing is I've forgotten how exactly to set a specific commit withnix flake update... Actually to be honest at this point we could probably just use the latestHEADanyway.This is kind of irrelevant now that we're about to bump to
HEADanyway in order to make use of some new features.@ -8,3 +9,3 @@rust-overlay = {url = "github:oxalica/rust-overlay";inputs.nixpkgs.follows = "nixpkgs";inputs.nixpkgs.follows = "nix-haskell/nixpkgs";The examples somehow avoid
flake-utils. We should perhaps try to do the same.Oh, actually, they're just hardcoding
x86_64-linux.Still, maybe I should look at using plain
genAttrsinstead. I know this is tricky with Haskell.Nix as it requires transposing the two outermost attrset layers.@ -50,1 +32,3 @@haskell.devShells.default(haskell.shell.overrideAttrs (old: {shellHook = builtins.replaceStrings [ "*wasm*|)" ] [ "*wasm*)" ] old.shellHook;}))This should just be
haskell.shell. Patched to avoid an annoying warning on enteringnix developshell:This seems like a
nix-haskellbug.Fixed upstream
@ -0,0 +14,4 @@c-expr-runtime = hs-bindgen-src + "/c-expr-runtime";hs-bindgen = hs-bindgen-src + "/hs-bindgen";hs-bindgen-runtime = hs-bindgen-src + "/hs-bindgen-runtime";libclang-bindings = libclang-src;I was hoping that these might just be picked up automatically from
cabal.project. Haskell.nix does do this, but then Cabal in the shell insists on building the libraries again itself anyway, which to be fair doesn't happen with this approach. See issue.Anyway, maybe it's fine. It is generally nice to have projects buildable without Nix. And retaining this property is a big part of the design goals of Haskell.nix. But it doesn't realistically matter in practice for this project.
And actually, having the flake inputs be the source of truth is quite convenient, as I've just realised when running
nix flake update hs-bindgen-srcfor the first time. Cabal has no equivalent CLI.@ -0,0 +35,4 @@};};withHoogle = false;withHaddock = true;These two don't seem to be working.
No HLS hover docs for any definitions from non-boot libs, e.g.
withHsBindgenordef. And I'm pretty sure I've seen Hoogle stuff get built anyway.Note that the HLS override does work.
To be fair, I don't think I tried
withHaddockor equivalent with plain Haskell.nix, so my expectations may be wrong.Checkout
From your project repository, check out a new branch and test the changes.