Skip to content

Commit b766284

Browse files
committed
survey: Add hack to make xmonad compile
1 parent 76d2cd3 commit b766284

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

survey/default.nix

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,20 @@ let
371371

372372
keyutils_static = pkgs.keyutils.overrideAttrs (old: { dontDisableStatic = true; });
373373

374+
libxcb_static = pkgs.xorg.libxcb.overrideAttrs (old: { dontDisableStatic = true; });
375+
# We'd like to make this depend on libxcb_static somehow, but neither adding
376+
# it to `buildInputs` via `overrideAttrs`, nor setting it with `.override`
377+
# seems to have the desired effect for the eventual link of `xmonad`.
378+
# So we use a custom `--ghc-options` hack for `xmonad` below.
379+
libX11_static = pkgs.xorg.libX11.overrideAttrs (old: { dontDisableStatic = true; });
380+
libXext_static = pkgs.xorg.libXext.overrideAttrs (old: { dontDisableStatic = true; });
381+
libXinerama_static = pkgs.xorg.libXinerama.overrideAttrs (old: { dontDisableStatic = true; });
382+
libXrandr_static = pkgs.xorg.libXrandr.overrideAttrs (old: { dontDisableStatic = true; });
383+
libXrender_static = pkgs.xorg.libXrender.overrideAttrs (old: { dontDisableStatic = true; });
384+
libXScrnSaver_static = pkgs.xorg.libXScrnSaver.overrideAttrs (old: { dontDisableStatic = true; });
385+
libXau_static = pkgs.xorg.libXau.overrideAttrs (old: { dontDisableStatic = true; });
386+
libXdmcp_static = pkgs.xorg.libXdmcp.overrideAttrs (old: { dontDisableStatic = true; });
387+
374388
krb5_static = pkgs.krb5.override {
375389
# Note krb5 does not support building both static and shared at the same time.
376390
staticOnly = true;
@@ -641,6 +655,28 @@ let
641655
executableToolDepends = [ pkgs.git ];
642656
});
643657

658+
X11 = super.X11.override {
659+
libX11 = libX11_static;
660+
libXext = libXext_static;
661+
libXinerama = libXinerama_static;
662+
libXrandr = libXrandr_static;
663+
libXrender = libXrender_static;
664+
libXScrnSaver = libXScrnSaver_static;
665+
};
666+
667+
# Note that xmonad links, but it doesn't run, because it tries to open
668+
# `libgmp.so.3` at run time.
669+
xmonad =
670+
appendConfigureFlag (addStaticLinkerFlagsWithPkgconfig
671+
super.xmonad
672+
[ libxcb_static libXau_static libXdmcp_static ]
673+
"--libs xcb Xau Xdmcp") [
674+
# The above `--libs` `pkgconfig` override seems to have no effect
675+
# but it at least makes the libraries available for manual `-l` flags.
676+
# It's also not clear why we incur a dependency on `Xdmcp` at all.
677+
"--ghc-option=-lxcb --ghc-option=-lXau --ghc-option=-lXrender --ghc-option=-lXdmcp"
678+
];
679+
644680
cryptonite =
645681
if integer-simple
646682
then disableCabalFlag super.cryptonite "integer-gmp"

0 commit comments

Comments
 (0)