Skip to content

Instantly share code, notes, and snippets.

@Tehnix
Last active April 12, 2020 20:42
Show Gist options
  • Save Tehnix/fc28ebfabc2a3db95687085190c2bd54 to your computer and use it in GitHub Desktop.
Save Tehnix/fc28ebfabc2a3db95687085190c2bd54 to your computer and use it in GitHub Desktop.
let
bootPkgs = import <nixpkgs> { };
ghcide-pkgs = import (builtins.fetchTarball
"https://github.com/hercules-ci/ghcide-nix/tarball/master") { };
# We use a patched fork of base-noprelude which is compatible with GHCJS.
base-noprelude-src = bootPkgs.fetchFromGitHub {
owner = "codetalkio";
repo = "base-noprelude";
rev = "00b9f86b788d5e3558846b292a6bf6b25816647b";
sha256 = "0ziqdg5n4fg83wykbbdhbmki5mksyzaxvw3bma2qain9hz5bran6";
};
overlay = self: pkgs:
with pkgs.haskell.lib; {
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
ghcjs86 = pkgs.haskell.packages.ghcjs86.override {
overrides = selfPkgs: superPkgs: {
base-noprelude =
selfPkgs.callCabal2nix "base-noprelude" base-noprelude-src { };
};
};
# FIXME: Currently enabling the override for ghc865 causes nix to fail with:
# error: attribute 'miso-jsaddle' missing
ghc865 = pkgs.haskell.packages.ghc865.override {
overrides = selfPkgs: superPkgs: {
base-noprelude =
selfPkgs.callCabal2nix "base-noprelude" base-noprelude-src { };
};
};
};
};
};
miso-pkgs = import (builtins.fetchTarball
"https://github.com/dmjio/miso/archive/5d7f377e3f8baf10ef259a6baf267a5705ebd175.tar.gz") {
overlays = [ overlay ];
};
in {
# miso-pkgs.pkgs.haskell.packages.ghcjs86.base-noprelude
# Inherit allows us to use the `miso-pkgs` and `ghcide-pkgs` variable from another lexical scope.
inherit bootPkgs;
inherit miso-pkgs;
inherit ghcide-pkgs;
# Our dev package set configures our Miso project with JSAddle and regular GHC.
dev = miso-pkgs.pkgs.haskell.packages.ghc865.callCabal2nix "miso-spa" ./. {
miso = miso-pkgs.miso-jsaddle;
};
# Our release package set configures our Miso project with GHCJS.
release =
miso-pkgs.pkgs.haskell.packages.ghcjs86.callCabal2nix "miso-spa" ./. { };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment