summaryrefslogtreecommitdiff
path: root/nix/overlay.nix
blob: 150cafbbdf5840ce8a09e7b9996aa848be218c08 (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
{ nix-filter, ... }:
final: prev: let
  src = nix-filter {
    root = ../.;
    include = [
      ../app
      ../src
      ../package.yaml
      ../templates
      # ../www-main.cabal
    ];
  };
in {
  haskellPackages = prev.haskellPackages.extend (hfinal: hprev: {
    www-main = hfinal.callCabal2nix "www-main" src {};
  });

  rubberWith = pkgs: prev.symlinkJoin {
    name = "rubber";
    nativeBuildInputs = [
      prev.makeWrapper
    ];
    paths = [
      prev.rubber
    ];
    postBuild = ''
      for x in $out/bin/*; do
        wrapProgram "$x" --prefix PATH : ${prev.lib.makeBinPath pkgs}
      done
    '';
  };

  hakyllWith = hakyll: pkgs: prev.symlinkJoin {
    inherit (hakyll) name;
    nativeBuildInputs = [
      prev.makeWrapper
    ];
    paths = [
      (final.haskell.lib.compose.justStaticExecutables hakyll)
    ];
    postBuild = ''
      for x in $out/bin/*; do
        wrapProgram "$x" --prefix PATH : ${prev.lib.makeBinPath pkgs}
      done
    '';
  };

  www-main = final.hakyllWith final.haskellPackages.www-main [
    (final.rubberWith [ prev.texlive.combined.scheme-full ])
    prev.rsync
  ];

  # site = prev.symlinkJoin {
  #   name = "site";
  #   paths = [
  #     (final.haskell.lib.compose.justStaticExecutables final.haskellPackages.www-main)
  #     prev.rsync
  #   ];
  # };
}