summaryrefslogtreecommitdiffstats
path: root/default.nix
blob: dc2a890f36f0222af794eed2b3292d658c4f0e5b (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
48
49
50
51
52
53
54
55
56
57
58
59
60
{ pkgs ? import (import ./nix/sources.nix).nixpkgs { } }:
let
  haskellPackages = pkgs.haskellPackages.override {
    overrides = self: super: {
      astatusbar = (self.callCabal2nix "astatusbar" ./. { }).overrideAttrs (oldAttrs: {
        nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [ pkgs.installShellFiles ];
        postInstall = oldAttrs.postInstall or "" + ''
          exe=${oldAttrs.pname}
          installShellCompletion --cmd $exe  \
            --bash <($out/bin/$exe --bash-completion-script $out/bin/$exe) \
            --fish <($out/bin/$exe --fish-completion-script $out/bin/$exe) \
            --zsh  <($out/bin/$exe --zsh-completion-script $out/bin/$exe)
        '';
      });
      sh = pkgs.haskell.lib.dontCheck (self.callCabal2nix "sh" (import ./nix/sources.nix).sh { });
      statvfs = pkgs.haskell.lib.markUnbroken (super.statvfs.overrideAttrs (oldAtts: {
        patches = [
          (pkgs.writers.writeText "statvfs.patch" ''
            diff --git a/Setup.hs b/Setup.hs
            index 7cf9bfd..54f57d6 100644
            --- a/Setup.hs
            +++ b/Setup.hs
            @@ -3,4 +3,4 @@ module Main (main) where
             import Distribution.Simple
 
             main :: IO ()
            -main = defaultMainWithHooks defaultUserHooks
            +main = defaultMainWithHooks autoconfUserHooks
          '')
        ];
      }));
      X11 = (self.callCabal2nix "X11"
        (pkgs.fetchFromGitHub {
          owner = "aforemny";
          repo = "X11";
          rev = "70d7a6fba00d4ffe65db90cd3a2e0883ca690a88";
          hash = "sha256-PsRtqaTyo+z8uPpsr7G3a0WF3Wh1NTWumu0rFlkLJMM=";
        })
        { }).overrideAttrs (oldAttrs: {
        preConfigure = oldAttrs.preConfigure or "" + ''
          ${pkgs.autoconf}/bin/autoreconf
        '';
      });
    };
  };
in
rec {
  inherit haskellPackages;
  inherit (haskellPackages) astatusbar;
  shell = haskellPackages.shellFor {
    packages = _: [ haskellPackages.astatusbar ];
    buildInputs = [
      pkgs.cabal-install
      (pkgs.nerdfonts.override { fonts = [ "IosevkaTerm" ]; })
      pkgs.niv
      pkgs.ormolu
    ];
    withHoogle = true;
  };
}