summaryrefslogtreecommitdiff
path: root/default.nix
blob: d86ae6c3bcedbe8995aac214695ed9e90ccc7558 (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
let
  sources = import ./nix/sources.nix {};
  haskellNix = import sources.haskellNix {};

  # Import nixpkgs and pass the haskell.nix provided nixpkgsArgs
  pkgs = import
    # use haskell.nix's nixpkgs, which may (?) have more substitutes available
    haskellNix.sources.nixpkgs-unstable
    # args for nixpkgs; includes the haskell.nix overlay
    (haskellNix.nixpkgsArgs // { system = "x86_64-linux"; });

  drvs = pkgs.haskell-nix.project {
   # 'cleanGit' cleans a source directory based on the files known by git
   src = pkgs.haskell-nix.haskellLib.cleanGit {
     src = ./.;
     name = "walint";
   };
   modules = [{
     packages.walint.components.exes = {
       # don't include gcc or ghc in the dependency closure …
       walint-server.dontStrip = false;
       walint.dontStrip = false;
     };
   }];
   stack-sha256 = "0bp3dwj2kl6n0swz5yf9kjy5ahp6i5qrnb39hkrsqgf0682i9nk1";
  };
in
{
  walint = drvs.walint.components.exes.walint;
  walint-server = pkgs.stdenvNoCC.mkDerivation {
    name = "walint-server-with-assets";
    src = drvs.walint.components.exes.walint-mapserver;
    phases = [ "buildPhase" ];
    buildPhase = ''
      mkdir -p $out
      cp -r $src/* $out
      cp -r ${pkgs.copyPathToStore ./static} $out/static
      cp ${pkgs.copyPathToStore ./config.json} $out/config.json
      cp ${pkgs.copyPathToStore ./config.toml} $out/config.toml
    '';
  };
}