summaryrefslogtreecommitdiff
path: root/ymir/mlmmj-expose.nix
blob: f1cf4dcc57617ba1237095c6386d4bc0b0cd4394 (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
{ config, pkgs, ... }:

let
  dependencies = pkgs: with pkgs; [ filepath
                                    directory
                                    cryptonite
                                    bytestring
                                    uuid
                                    aeson
                                    aeson-pretty
                                  ];

in rec {
  nixpkgs.overlays = [(self: super: {
    mlmmj-exposed = super.stdenv.mkDerivation rec {
      name = "mlmmj-expose";
      
      src = ./mlmmj-expose;

      phases = [ "unpackPhase" "buildPhase" "installPhase" ];

      env = self.haskellPackages.ghcWithPackages dependencies;

      buildPhase = ''
        ${env}/bin/ghc -o mlmmj-expose -odir . -hidir . mlmmj-expose.hs
      '';

      installPhase = ''
        mkdir -p $out/bin
        cp mlmmj-expose $out/bin/.mlmmj-expose

        for f in mlmmj-exposed mlmmj-expose mlmmj-get-exposed mlmmj-serve-exposed; do
          ln -s .mlmmj-expose $out/bin/$f
        done
      '';
    };
  })];
  environment.systemPackages = with pkgs; [ mlmmj-exposed ];
}