- Install Docker for Windows
- Change docker settings
- Increase RAM
- Enable shared drive
- Create a new folder and open a terminal inside it
- Start a docker container with interactive shell, forwarding port 6400 for GHCJSi:
docker run -p 6400:6400 -it -v <local path>:/project -w /project lnl7/nix:2018-01-13 bash
- Run
nix-env -i cabal-install cabal2nix ghc
- Installs cabal, cabal2nix and ghc using nix
- Run
cabal update && cabal init
- Initialise cabal and create a new project
- Run
cabal2nix . > default.nix
- This creates a nix derivation with dependencies based on the .cabal file
- Run this again when the dependencies in the .cabal file have changed
- Create a
release.nix
with the following content:
let
bootstrap = import <nixpkgs> { };
nixpkgs = builtins.fromJSON (builtins.readFile ./nixpkgs.json);
src = bootstrap.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
inherit (nixpkgs) rev sha256;
};
pkgs = import src { };
in
{
project = pkgs.haskell.packages.ghcjsHEAD.callPackage ./default.nix { };
}
- This pins the version of 'nixpkgs' to the one specified in
nixpkgs.json
(next slide)
..and a nixpkgs.json
with
{
"url": "https://github.com/NixOS/nixpkgs.git",
"rev": "fcc8cae88d5429ae2693b03e870dfc4fe6a1c6bf",
"date": "2018-01-20T15:47:59-05:00",
"sha256": "0bpzwiyam6a68wp8bizlkdsazdfq2xyfwa7wjaydf8ps64avr23p",
"fetchSubmodules": true
}
- We need to use
fcc8cae
or newer to get a working build of GHCJS - This file was created with
nix-prefetch-git
nix-shell --attr project.env release.nix
- Brings all packages into scope
cabal new-configure -O0 --ghcjs
cabal new-build