summaryrefslogtreecommitdiff
path: root/overlays/spm/default.nix
blob: ff13527963eba640c2893eb61e1f00c2679270eb (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
40
41
42
43
44
45
46
47
{ final, prev, ... }:
let
  spm = let
    # defaultPackages = (import ./stackage.nix {});
    # haskellPackages = defaultPackages // argumentPackages;
    # haskellPackages = argumentPackages;
    haskellPackages = final.haskell.packages.ghc96.override {
      overrides = self: super: {
        warp-systemd = final.haskell.lib.doJailbreak (super.warp-systemd.overrideAttrs (oldAttrs: { meta = oldAttrs.meta // { broken = false; }; }));
        unliftio-pool = final.haskell.lib.doJailbreak super.unliftio-pool;
      #    servant-server = super.servant-server.overrideAttrs (oldAttrs: {
      #      patches = [];
      #    });
      #    hpack = super.hpack.overrideAttrs (oldAttrs: rec {
      #      version = "0.35.0";
      #      src = prev.fetchFromGitHub {
      #        owner = "sol";
      #        repo = "hpack";
      #        rev = "0.35.0";
      #        hash = "sha256-DMxCHwz9x2e4kSOIk1/qeW3aDFHw88LNW+4vXxDV9EI=";
      #      };
      #    });
      };
    };

    spm-frontend = final.callPackage ./frontend {
      baseHref = "/ui/";
    };
  in final.haskell.lib.overrideCabal (haskellPackages.callPackage ./spm.nix {}) (oldAttrs: {
    src = final.lib.cleanSourceWith rec {
      filter = let
        isFiltered = src ? _isLibCleanSourceWith;
        origSrc = if isFiltered then src.origSrc else src;
        relPath = path: final.lib.removePrefix (toString origSrc + "/") (toString path);
      in path: _type: builtins.match "^frontend(/.*)?$" (relPath path) == null;
      src = ./.;
    };

    postPatch = ''
      ${oldAttrs.postPatch or ""}

      ln -sfTv ${spm-frontend} frontend
    '';
  });
in {
  inherit spm;
}