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

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

in rec {
  nixpkgs.config.overlays = [(self: super: {
    mlmmj-exposed = super.stdenv.mkDerivation {
      name = "mlmmj-expose";
      src = super.substituteAll {
        src = ./mlmmj-expose.hs;
        inherit (pkgs) mlmmj;
      };
      buildCommand = let
        haskellEnv = self.haskellPackages.ghcWithPackages dependencies;
      in ''
        mkdir -p $out/bin
        #cp $src $out/bin/.mlmmj-exposed
        ${haskellEnv}/bin/ghc -o $out/bin/.mlmmj-expose -odir . -hidir . $src
        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 ];
}