{ config, pkgs, ... }: let dependencies = pkgs: with pkgs; [ filepath directory cryptonite bytestring uuid aeson aeson-pretty mtl ]; in rec { nixpkgs.overlays = [(self: super: { mlmmj-exposed = super.stdenv.mkDerivation rec { name = "mlmmj-expose"; src = ./mlmmj-expose; phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ]; env = self.haskellPackages.ghcWithPackages dependencies; import (pkgs) mlmmj; patchPhase = '' substituteAllInPlace mlmmj-expose.hs ''; 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 ]; }