aboutsummaryrefslogtreecommitdiffstats
path: root/default.nix
blob: 39a3bd66052e7a946680750031830f39773cf7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ pkgs ? import sources.nixpkgs {
    overlays = [
      (import "${sources.acms}/pkgs" { })
      (import ./pkgs { })
      (self: super: {
        haskell = super.haskell // {
          packageOverrides = self.lib.composeManyExtensions [
            super.haskell.packageOverrides
            (self: super: {
              ghcWithPackages = super.ghcWithPackages.override {
                installDocumentation = false; # XXX true (default)
              };
            })
          ];
        };
      })
    ];
  }
, sources ? import ./nix/sources.nix
}:
let ghc = "ghc910"; in
rec {
  frontend = pkgs.pkgsCross.ghcjs.haskell.packages.${ghc}.achat;
  backend = pkgs.haskell.packages.${ghc}.achat;
  shell = pkgs.mkShell {
    inputsFrom = [
      (pkgs.pkgsCross.ghcjs.haskell.packages.${ghc}.shellFor {
        packages = haskellPackages: [
          haskellPackages.achat
        ];
      })
      (pkgs.haskell.packages.${ghc}.shellFor {
        packages = haskellPackages: [
          haskellPackages.achat
        ];
      })
      (pkgs.mkShell {
        buildInputs = [
          pkgs.haskell.packages.${ghc}.cabal-install
          pkgs.haskell.packages.${ghc}.ormolu
          (pkgs.writers.writeDashBin "build-frontend" ''
            set -efu
            cabal \
              --with-compiler=javascript-unknown-ghcjs-ghc \
              --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg \
              build
          '')
          (pkgs.writers.writeDashBin "build-backend" ''
            set -efu
            cabal build
          '')
          (pkgs.writers.writeDashBin "build" ''
            set -efu
            build-frontend
            build-backend
          '')
          pkgs.python3
        ];
        shellHook = ''
          export EM_CACHE="${toString ./.}/.emcache" # nixos/nixpkgs#282509
        '';
      })
    ];
  };
}