xsession: remove xsession.windowManager
option
This removes the deprecated use of `xsession.windowManager` as a string. This commit also adjusts the xmonad module to become a full module. I.e., the backwards compatibility hack was removed.
This commit is contained in:
parent
82d6aa0c97
commit
78a1424582
|
@ -57,6 +57,7 @@ let
|
|||
./services/taffybar.nix
|
||||
./services/tahoe-lafs.nix
|
||||
./services/udiskie.nix
|
||||
./services/window-managers/xmonad.nix
|
||||
./services/xscreensaver.nix
|
||||
./systemd.nix
|
||||
./xresources.nix
|
||||
|
|
|
@ -240,22 +240,6 @@ in
|
|||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-09-28T21:39:45+00:00";
|
||||
condition =
|
||||
config.xsession.enable
|
||||
&& config.xsession.windowManager.usesDeprecated;
|
||||
message = ''
|
||||
The 'xsession.windowManager' option is now deprecated,
|
||||
please use 'xsession.windowManager.command' instead.
|
||||
|
||||
This change was made to prepare for window manager modules
|
||||
under the 'xsession.windowManager' namespace. For example,
|
||||
'xsession.windowManager.xmonad' and
|
||||
'xsession.windowManager.i3'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-09-30T09:44:18+00:00";
|
||||
condition = with config.programs.vim;
|
||||
|
@ -339,19 +323,6 @@ in
|
|||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-10-19T09:33:10+00:00";
|
||||
condition =
|
||||
config.xsession.enable
|
||||
&& config.xsession.windowManager.usesDeprecated;
|
||||
message = ''
|
||||
The 'xsession.windowManager' option is deprecated and will
|
||||
be removed on October 31, 2017. To avoid evaluation errors
|
||||
you must change to using 'xsession.windowManager.command'
|
||||
before that date.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2017-10-20T12:15:27+00:00";
|
||||
condition = with config.systemd.user;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{ pkgs }: { config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with import ../../lib/dag.nix { inherit lib; };
|
||||
|
||||
let
|
||||
|
||||
cfg = config.xmonad;
|
||||
cfg = config.xsession.windowManager.xmonad;
|
||||
|
||||
xmonad = pkgs.xmonad-with-packages.override {
|
||||
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
|
||||
|
@ -19,7 +20,7 @@ in
|
|||
|
||||
{
|
||||
options = {
|
||||
xmonad = {
|
||||
xsession.windowManager.xmonad = {
|
||||
enable = mkEnableOption "xmonad window manager";
|
||||
|
||||
haskellPackages = mkOption {
|
||||
|
@ -80,7 +81,32 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
command = "${xmonad}/bin/xmonad";
|
||||
};
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
xsession.windowManager.command = "${xmonad}/bin/xmonad";
|
||||
}
|
||||
|
||||
(mkIf (cfg.config != null) {
|
||||
home.file.".xmonad/xmonad.hs".source = cfg.config;
|
||||
|
||||
home.activation.checkXmonad = dagEntryBefore [ "linkGeneration" ] ''
|
||||
if ! cmp --quiet "${cfg.config}" "$HOME/.xmonad/xmonad.hs"; then
|
||||
xmonadChanged=1
|
||||
fi
|
||||
'';
|
||||
|
||||
home.activation.applyXmonad = dagEntryAfter [ "linkGeneration" ] ''
|
||||
if [[ -v xmonadChanged ]]; then
|
||||
echo "Recompiling xmonad"
|
||||
${config.xsession.windowManager.command} --recompile
|
||||
|
||||
# Attempt to restart xmonad if X is running.
|
||||
if [[ -v DISPLAY ]] ; then
|
||||
echo "Restarting xmonad"
|
||||
${config.xsession.windowManager.command} --restart
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with import ./lib/dag.nix { inherit lib; };
|
||||
|
||||
let
|
||||
|
||||
cfg = config.xsession;
|
||||
|
||||
# Hack to support xsession.windowManager.command option.
|
||||
wmBaseModule = {
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
command = mkOption {
|
||||
xsession = {
|
||||
enable = mkEnableOption "X Session";
|
||||
|
||||
windowManager.command = mkOption {
|
||||
type = types.str;
|
||||
example = literalExample ''
|
||||
let
|
||||
|
@ -25,39 +30,6 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
usesDeprecated = mkOption {
|
||||
internal = true;
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xmonadModule = import ./services/window-managers/xmonad.nix {
|
||||
inherit pkgs;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
xsession = {
|
||||
enable = mkEnableOption "X Session";
|
||||
|
||||
windowManager = mkOption {
|
||||
type =
|
||||
types.coercedTo
|
||||
types.str
|
||||
(command: { inherit command; usesDeprecated = true; })
|
||||
(types.submodule [ wmBaseModule xmonadModule ]);
|
||||
description = ''
|
||||
Window manager start command. DEPRECATED: Use
|
||||
<varname>xsession.windowManager.command</varname> instead.
|
||||
'';
|
||||
};
|
||||
|
||||
profileExtra = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
|
@ -72,43 +44,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.windowManager.usesDeprecated {
|
||||
warnings = [
|
||||
("xsession.windowManager is deprecated, "
|
||||
+ "please use xsession.windowManager.command")
|
||||
];
|
||||
})
|
||||
|
||||
# Hack to support xsession.windowManager as a string. Once that is
|
||||
# removed this code should go back into the xmonad.nix file.
|
||||
(mkIf (cfg.windowManager.xmonad.enable
|
||||
&& cfg.windowManager.xmonad.config != null) {
|
||||
home.file.".xmonad/xmonad.hs".source = cfg.windowManager.xmonad.config;
|
||||
|
||||
home.activation.checkXmonad = dagEntryBefore [ "linkGeneration" ] ''
|
||||
if ! cmp --quiet \
|
||||
"${cfg.windowManager.xmonad.config}" \
|
||||
"$HOME/.xmonad/xmonad.hs"; then
|
||||
xmonadChanged=1
|
||||
fi
|
||||
'';
|
||||
|
||||
home.activation.applyXmonad = dagEntryAfter [ "linkGeneration" ] ''
|
||||
if [[ -v xmonadChanged ]]; then
|
||||
echo "Recompiling xmonad"
|
||||
${cfg.windowManager.command} --recompile
|
||||
|
||||
# Attempt to restart xmonad if X is running.
|
||||
if [[ -v DISPLAY ]] ; then
|
||||
echo "Restarting xmonad"
|
||||
${cfg.windowManager.command} --restart
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
})
|
||||
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.setxkbmap = {
|
||||
Unit = {
|
||||
Description = "Set up keyboard in X";
|
||||
|
@ -191,6 +127,5 @@ in
|
|||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
]);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue