nixos/xmonad: move to haskell-ng and make a wrapper
This commit is contained in:
parent
f8038b0c6c
commit
b7bb524f04
|
@ -3,11 +3,12 @@
|
|||
let
|
||||
inherit (lib) mkOption mkIf optionals literalExample;
|
||||
cfg = config.services.xserver.windowManager.xmonad;
|
||||
xmonadEnv = cfg.haskellPackages.ghcWithPackages(self: [
|
||||
self.xmonad
|
||||
] ++ optionals cfg.enableContribAndExtras [ self.xmonadContrib self.xmonadExtras]
|
||||
++ optionals (cfg.extraPackages != null) (cfg.extraPackages self));
|
||||
xmessage = pkgs.xlibs.xmessage;
|
||||
xmonad = pkgs.xmonad-with-packages.override {
|
||||
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
|
||||
packages = self: cfg.extraPackages self ++
|
||||
optionals cfg.enableContribAndExtras
|
||||
[ self.xmonad-contrib self.xmonad-extras ];
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
@ -19,9 +20,9 @@ in
|
|||
};
|
||||
|
||||
haskellPackages = mkOption {
|
||||
default = pkgs.haskellPackages;
|
||||
defaultText = "pkgs.haskellPackages";
|
||||
example = literalExample "pkgs.haskellPackages_ghc701";
|
||||
default = pkgs.haskellngPackages;
|
||||
defaultText = "pkgs.haskellngPackages";
|
||||
example = literalExample "pkgs.haskell-ng.packages.ghc784";
|
||||
description = ''
|
||||
haskellPackages used to build Xmonad and other packages.
|
||||
This can be used to change the GHC version used to build
|
||||
|
@ -31,17 +32,17 @@ in
|
|||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
default = null;
|
||||
default = self: [];
|
||||
example = literalExample ''
|
||||
haskellPackages: [
|
||||
haskellPackages.xmonadContrib
|
||||
haskellPackages.monadLogger
|
||||
haskellPackages.xmonad-contrib
|
||||
haskellPackages.monad-logger
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
Extra packages available to ghc when rebuilding Xmonad. The
|
||||
value must be a function which receives the attrset defined
|
||||
in <varname>haskellpackages</varname> as the sole argument.
|
||||
in <varname>haskellPackages</varname> as the sole argument.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -58,12 +59,12 @@ in
|
|||
session = [{
|
||||
name = "xmonad";
|
||||
start = ''
|
||||
XMONAD_GHC=${xmonadEnv}/bin/ghc XMONAD_XMESSAGE=${xmessage}/bin/xmessage xmonad &
|
||||
${xmonad}/bin/xmonad &
|
||||
waitPID=$!
|
||||
'';
|
||||
}];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.haskellPackages.xmonad ];
|
||||
environment.systemPackages = [ xmonad ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ cabal.mkDerivation (self: {
|
|||
'';
|
||||
patches = [
|
||||
# Patch to make xmonad use XMONAD_{GHC,XMESSAGE} (if available).
|
||||
./xmonad_ghc_var_0.11.patch
|
||||
../../../development/haskell-modules/xmonad-nix.patch
|
||||
];
|
||||
meta = {
|
||||
homepage = "http://xmonad.org";
|
||||
|
|
22
pkgs/applications/window-managers/xmonad/wrapper.nix
Normal file
22
pkgs/applications/window-managers/xmonad/wrapper.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ stdenv, buildEnv, ghcWithPackages, xmessage, makeWrapper, packages }:
|
||||
|
||||
let
|
||||
xmonadEnv = ghcWithPackages (self: [ self.xmonad ] ++ packages self);
|
||||
drv = buildEnv {
|
||||
name = "xmonad-with-packages";
|
||||
|
||||
paths = [ xmonadEnv ];
|
||||
|
||||
postBuild = ''
|
||||
# TODO: This could be avoided if buildEnv could be forced to create all directories
|
||||
rm $out/bin
|
||||
mkdir $out/bin
|
||||
for i in ${xmonadEnv}/bin/*; do
|
||||
ln -s $i $out/bin
|
||||
done
|
||||
wrapProgram $out/bin/xmonad \
|
||||
--set XMONAD_GHC "${xmonadEnv}/bin/ghc" \
|
||||
--set XMONAD_XMESSAGE "${xmessage}/bin/xmessage"
|
||||
'';
|
||||
};
|
||||
in stdenv.lib.overrideDerivation drv (x : { buildInputs = x.buildInputs ++ [ makeWrapper ]; })
|
|
@ -409,6 +409,9 @@ self: super: {
|
|||
# https://github.com/seagreen/hjsonschema/issues/4
|
||||
hjsonschema = dontCheck super.hjsonschema;
|
||||
|
||||
# Nix-specific workaround
|
||||
xmonad = appendPatch super.xmonad ./xmonad-nix.patch;
|
||||
|
||||
} // {
|
||||
|
||||
# Not on Hackage.
|
||||
|
|
|
@ -11805,6 +11805,11 @@ let
|
|||
|
||||
xkb_switch = callPackage ../tools/X11/xkb-switch { };
|
||||
|
||||
xmonad-with-packages = callPackage ../applications/window-managers/xmonad/wrapper.nix {
|
||||
ghcWithPackages = haskellngPackages.ghcWithPackages;
|
||||
packages = self: [];
|
||||
};
|
||||
|
||||
xmonad_log_applet_gnome2 = callPackage ../applications/window-managers/xmonad-log-applet {
|
||||
desktopSupport = "gnome2";
|
||||
inherit (xfce) libxfce4util xfce4panel;
|
||||
|
|
Loading…
Reference in a new issue