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
{ lib, pkgs, ... }:

let
  utilsSrc = pkgs.fetchFromGitHub {
    owner = "Profpatsch";
    repo = "utils.hs";
    rev = "f53264978042d8041831a3ac3766aa1dfdc60b57";
    sha256 = "18mxcbi6cv81y3jvp9lrfp793vayvd9llpkcjh5szb8vi1kizrgy";
  };
  version = "git";

  hps =
    let hlib = pkgs.haskell.lib; in
    pkgs.haskellPackages.override {
      overrides = (hself: hsuper: {
        these = hlib.doJailbreak hsuper.these;
      });
    };

  haskellDrv = { name, subfolder, deps }: hps.mkDerivation {
    pname = name;
    inherit version;
    src = "${utilsSrc}/${subfolder}";
    license = lib.licenses.gpl3;
    isExecutable = true;
    buildDepends = deps;
    enableSharedExecutables = false;
    enableLibraryProfiling = false;
    isLibrary = false;
    doHaddock = false;
    postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc";
  };

  until = haskellDrv {
    name = "until";
    subfolder = "until";
    deps = with hps; [ optparse-applicative data-fix time ];
  };

in {
  inherit until;
}