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

let
  haskellEnv = pkgs.haskellPackages.ghcWithPackages dependencies;
  dependencies = pkgs: with pkgs; [ filepath
                                    directory
                                    cryptonite
                                    bytestring
                                    uuid
                                    aeson
                                    aeson-pretty
                                  ];
  mlmmj-exposed = pkgs.stdenv.mkDerivation {
    name = "mlmmj-expose";
    src = pkgs.substituteAll {
      src = ./mlmmj-expose.hs;
      inherit (pkgs) mlmmj;
    };
    buildCommand = ''
      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
    '';
  };
in rec {
  nixpkgs.config.packageOverrides = pkgs: rec {
    inherit mlmmj-exposed;
  };
  environment.systemPackages = [ mlmmj-exposed ];
}