1# How to employ Nix to compose/deploy the build environment:
2#
3# 1. Get derivation path:
4#
5# $ STOREDRVPATH=$(nix-instantiate --no-build-output --cores 4 -E 'import ./shell.nix { closure-generation-mode = true; repo-commit-id="commit-id"; repo-commit-sha256="nix-hash"; }')
6#
7# 2. Export closure on the source host:
8#
9# $ nix-store --export $(nix-store --query --requisites --include-outputs ${STOREDRVPATH}) > ~/barrelfish.closure
10#
11# 3. Import closure on the target host (and transfer the value of STOREDRVPATH):
12#
13# $ nix-store --import barrelfish.closure
14#
15# 4. Enter shell :
16#
17# $ nix-shell ${STOREDRVPATH}
18
19{ nixpkgs ? import <nixpkgs> {}
20, ghc-version ? "ghc801"
21
22, closure-generation-mode ? false
23, propagate-deps ? closure-generation-mode
24, use-repo-source ? closure-generation-mode
25, repo-url ? ""
26, repo-commit-id ? ""
27, repo-commit-sha256 ? ""
28}:
29
30let
31
32  inherit (nixpkgs) pkgs;
33
34  f = import ./.; # your default.nix
35
36in
37
38  pkgs.callPackage f {
39    haskell = pkgs.haskell;
40
41    inherit ghc-version;
42    inherit propagate-deps use-repo-source repo-url repo-commit-id repo-commit-sha256;
43  }
44