summaryrefslogtreecommitdiff
path: root/overlays/spm/default.nix
blob: 280f1e6c00eae5263439ae731bbf0193a2155716 (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
{ 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; }; }));
      #    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;
}