summaryrefslogtreecommitdiffstats
path: root/default.nix
blob: a0d748b1f0b92c5e51d125062c78290381075ac0 (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
61
62
63
64
65
66
{ pkgs ? import (import ./nix/sources.nix).nixpkgs { } }:
let
  haskellPackages = pkgs.haskellPackages.override {
    overrides = self: super: {
      astatusbar = self.callCabal2nix "astatusbar" ./. { };
      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 = "xmonad";
          repo = "X11";
          rev = "1ead9698c89e78884ac771c93822447999a1dc46";
          hash = "sha256-OAZ3gnUezsumBC8VwhcsKq+Nrq44L4xY/z6exK7InLo=";
        })
        { }).overrideAttrs (oldAttrs: {
        preConfigure = oldAttrs.preConfigure or "" + ''
          ${pkgs.autoconf}/bin/autoreconf'';
        patches = oldAttrs.patches or [ ] ++ [
          (pkgs.writers.writeText "X11-safe-select.patch" ''
            diff --git a/Graphics/X11/Xlib/Event.hsc b/Graphics/X11/Xlib/Event.hsc
            index 842fc2f..869aba8 100644
            --- a/Graphics/X11/Xlib/Event.hsc
            +++ b/Graphics/X11/Xlib/Event.hsc
            @@ -419,7 +419,7 @@ newtype FdSet = FdSet (Ptr FdSet)
             foreign import ccall unsafe "HsXlib.h" fdZero :: Ptr FdSet -> IO ()
             foreign import ccall unsafe "HsXlib.h" fdSet :: CInt -> Ptr FdSet -> IO ()

            -foreign import ccall unsafe "HsXlib.h" select ::
            +foreign import ccall safe "HsXlib.h" select ::
                     CInt -> Ptr FdSet -> Ptr FdSet -> Ptr FdSet -> Ptr TimeVal -> IO CInt

             -- | This function is somewhat compatible with Win32's @TimeGetTime()@
          '')
        ];
      });
    };
  };
in
rec {
  inherit haskellPackages;
  inherit (haskellPackages) astatusbar;
  shell = haskellPackages.shellFor {
    packages = _: [ haskellPackages.astatusbar ];
    buildInputs = [
      pkgs.cabal-install
      pkgs.niv
      pkgs.ormolu
    ];
    withHoogle = true;
  };
}