lol

Merge pull request #5025 from abbradar/xmonad-wrapper

nixos/xmonad: make a wrapper

+46 -15
+15 -14
nixos/modules/services/x11/window-managers/xmonad.nix
··· 3 let 4 inherit (lib) mkOption mkIf optionals literalExample; 5 cfg = config.services.xserver.windowManager.xmonad; 6 - xmonadEnv = cfg.haskellPackages.ghcWithPackages(self: [ 7 - self.xmonad 8 - ] ++ optionals cfg.enableContribAndExtras [ self.xmonadContrib self.xmonadExtras] 9 - ++ optionals (cfg.extraPackages != null) (cfg.extraPackages self)); 10 - xmessage = pkgs.xlibs.xmessage; 11 in 12 { 13 options = { ··· 19 }; 20 21 haskellPackages = mkOption { 22 - default = pkgs.haskellPackages; 23 - defaultText = "pkgs.haskellPackages"; 24 - example = literalExample "pkgs.haskellPackages_ghc701"; 25 description = '' 26 haskellPackages used to build Xmonad and other packages. 27 This can be used to change the GHC version used to build ··· 31 }; 32 33 extraPackages = mkOption { 34 - default = null; 35 example = literalExample '' 36 haskellPackages: [ 37 - haskellPackages.xmonadContrib 38 - haskellPackages.monadLogger 39 ] 40 ''; 41 description = '' 42 Extra packages available to ghc when rebuilding Xmonad. The 43 value must be a function which receives the attrset defined 44 - in <varname>haskellpackages</varname> as the sole argument. 45 ''; 46 }; 47 ··· 58 session = [{ 59 name = "xmonad"; 60 start = '' 61 - XMONAD_GHC=${xmonadEnv}/bin/ghc XMONAD_XMESSAGE=${xmessage}/bin/xmessage xmonad & 62 waitPID=$! 63 ''; 64 }]; 65 }; 66 67 - environment.systemPackages = [ cfg.haskellPackages.xmonad ]; 68 }; 69 }
··· 3 let 4 inherit (lib) mkOption mkIf optionals literalExample; 5 cfg = config.services.xserver.windowManager.xmonad; 6 + xmonad = pkgs.xmonad-with-packages.override { 7 + ghcWithPackages = cfg.haskellPackages.ghcWithPackages; 8 + packages = self: cfg.extraPackages self ++ 9 + optionals cfg.enableContribAndExtras 10 + [ self.xmonad-contrib self.xmonad-extras ]; 11 + }; 12 in 13 { 14 options = { ··· 20 }; 21 22 haskellPackages = mkOption { 23 + default = pkgs.haskellngPackages; 24 + defaultText = "pkgs.haskellngPackages"; 25 + example = literalExample "pkgs.haskell-ng.packages.ghc784"; 26 description = '' 27 haskellPackages used to build Xmonad and other packages. 28 This can be used to change the GHC version used to build ··· 32 }; 33 34 extraPackages = mkOption { 35 + default = self: []; 36 example = literalExample '' 37 haskellPackages: [ 38 + haskellPackages.xmonad-contrib 39 + haskellPackages.monad-logger 40 ] 41 ''; 42 description = '' 43 Extra packages available to ghc when rebuilding Xmonad. The 44 value must be a function which receives the attrset defined 45 + in <varname>haskellPackages</varname> as the sole argument. 46 ''; 47 }; 48 ··· 59 session = [{ 60 name = "xmonad"; 61 start = '' 62 + ${xmonad}/bin/xmonad & 63 waitPID=$! 64 ''; 65 }]; 66 }; 67 68 + environment.systemPackages = [ xmonad ]; 69 }; 70 }
+1 -1
pkgs/applications/window-managers/xmonad/default.nix
··· 18 ''; 19 patches = [ 20 # Patch to make xmonad use XMONAD_{GHC,XMESSAGE} (if available). 21 - ./xmonad_ghc_var_0.11.patch 22 ]; 23 meta = { 24 homepage = "http://xmonad.org";
··· 18 ''; 19 patches = [ 20 # Patch to make xmonad use XMONAD_{GHC,XMESSAGE} (if available). 21 + ../../../development/haskell-modules/xmonad-nix.patch 22 ]; 23 meta = { 24 homepage = "http://xmonad.org";
+22
pkgs/applications/window-managers/xmonad/wrapper.nix
···
··· 1 + { stdenv, buildEnv, ghcWithPackages, xmessage, makeWrapper, packages }: 2 + 3 + let 4 + xmonadEnv = ghcWithPackages (self: [ self.xmonad ] ++ packages self); 5 + drv = buildEnv { 6 + name = "xmonad-with-packages"; 7 + 8 + paths = [ xmonadEnv ]; 9 + 10 + postBuild = '' 11 + # TODO: This could be avoided if buildEnv could be forced to create all directories 12 + rm $out/bin 13 + mkdir $out/bin 14 + for i in ${xmonadEnv}/bin/*; do 15 + ln -s $i $out/bin 16 + done 17 + wrapProgram $out/bin/xmonad \ 18 + --set XMONAD_GHC "${xmonadEnv}/bin/ghc" \ 19 + --set XMONAD_XMESSAGE "${xmessage}/bin/xmessage" 20 + ''; 21 + }; 22 + in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; })
pkgs/applications/window-managers/xmonad/xmonad_ghc_var_0.11.patch pkgs/development/haskell-modules/xmonad-nix.patch
+3
pkgs/development/haskell-modules/configuration-common.nix
··· 409 # https://github.com/seagreen/hjsonschema/issues/4 410 hjsonschema = dontCheck super.hjsonschema; 411 412 } // { 413 414 # Not on Hackage.
··· 409 # https://github.com/seagreen/hjsonschema/issues/4 410 hjsonschema = dontCheck super.hjsonschema; 411 412 + # Nix-specific workaround 413 + xmonad = appendPatch super.xmonad ./xmonad-nix.patch; 414 + 415 } // { 416 417 # Not on Hackage.
+5
pkgs/top-level/all-packages.nix
··· 11812 11813 xkb_switch = callPackage ../tools/X11/xkb-switch { }; 11814 11815 xmonad_log_applet_gnome2 = callPackage ../applications/window-managers/xmonad-log-applet { 11816 desktopSupport = "gnome2"; 11817 inherit (xfce) libxfce4util xfce4panel;
··· 11812 11813 xkb_switch = callPackage ../tools/X11/xkb-switch { }; 11814 11815 + xmonad-with-packages = callPackage ../applications/window-managers/xmonad/wrapper.nix { 11816 + ghcWithPackages = haskellngPackages.ghcWithPackages; 11817 + packages = self: []; 11818 + }; 11819 + 11820 xmonad_log_applet_gnome2 = callPackage ../applications/window-managers/xmonad-log-applet { 11821 desktopSupport = "gnome2"; 11822 inherit (xfce) libxfce4util xfce4panel;