2018-10-23 23:17:51 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.sway-beta;
|
|
|
|
swayPackage = cfg.package;
|
2018-11-03 17:27:40 +00:00
|
|
|
|
|
|
|
swayWrapped = pkgs.writeShellScriptBin "sway" ''
|
2018-12-01 14:00:19 +00:00
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then
|
|
|
|
export _SWAY_WRAPPER_ALREADY_EXECUTED=1
|
|
|
|
${cfg.extraSessionCommands}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
|
|
|
export DBUS_SESSION_BUS_ADDRESS
|
|
|
|
exec ${swayPackage}/bin/sway "$@"
|
|
|
|
else
|
|
|
|
exec ${pkgs.dbus}/bin/dbus-run-session ${swayPackage}/bin/sway "$@"
|
|
|
|
fi
|
2018-11-03 17:27:40 +00:00
|
|
|
'';
|
|
|
|
swayJoined = pkgs.symlinkJoin {
|
|
|
|
name = "sway-joined";
|
|
|
|
paths = [ swayWrapped swayPackage ];
|
|
|
|
};
|
2018-10-23 23:17:51 +01:00
|
|
|
in {
|
|
|
|
options.programs.sway-beta = {
|
|
|
|
enable = mkEnableOption ''
|
|
|
|
Sway, the i3-compatible tiling Wayland compositor. This module will be removed after the final release of Sway 1.0
|
|
|
|
'';
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.sway-beta;
|
|
|
|
defaultText = "pkgs.sway-beta";
|
|
|
|
description = ''
|
|
|
|
The package to be used for `sway`.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-11-03 17:27:40 +00:00
|
|
|
extraSessionCommands = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
example = ''
|
|
|
|
export SDL_VIDEODRIVER=wayland
|
|
|
|
# needs qt5.qtwayland in systemPackages
|
|
|
|
export QT_QPA_PLATFORM=wayland
|
|
|
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
|
|
|
# Fix for some Java AWT applications (e.g. Android Studio),
|
|
|
|
# use this if they aren't displayed properly:
|
|
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Shell commands executed just before Sway is started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2018-10-23 23:17:51 +01:00
|
|
|
extraPackages = mkOption {
|
|
|
|
type = with types; listOf package;
|
|
|
|
default = with pkgs; [
|
2018-11-03 17:27:40 +00:00
|
|
|
xwayland rxvt_unicode dmenu
|
2018-10-23 23:17:51 +01:00
|
|
|
];
|
|
|
|
defaultText = literalExample ''
|
2018-11-03 17:27:40 +00:00
|
|
|
with pkgs; [ xwayland rxvt_unicode dmenu ];
|
2018-10-23 23:17:51 +01:00
|
|
|
'';
|
|
|
|
example = literalExample ''
|
|
|
|
with pkgs; [
|
|
|
|
xwayland
|
|
|
|
i3status i3status-rust
|
|
|
|
termite rofi light
|
|
|
|
]
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
Extra packages to be installed system wide.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2018-11-03 17:27:40 +00:00
|
|
|
environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages;
|
2018-10-23 23:17:51 +01:00
|
|
|
security.pam.services.swaylock = {};
|
|
|
|
hardware.opengl.enable = mkDefault true;
|
|
|
|
fonts.enableDefaultFonts = mkDefault true;
|
|
|
|
programs.dconf.enable = mkDefault true;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ];
|
|
|
|
}
|