Skip to content

Commit

Permalink
Merge pull request #49687 from gnidorah/sway
Browse files Browse the repository at this point in the history
sway-beta module: add missing pieces
  • Loading branch information
primeos committed Nov 4, 2018
2 parents 4a7cdf4 + 15c2fb7 commit f319c7f
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions nixos/modules/programs/sway-beta.nix
Expand Up @@ -5,6 +5,15 @@ with lib;
let
cfg = config.programs.sway-beta;
swayPackage = cfg.package;

swayWrapped = pkgs.writeShellScriptBin "sway" ''
${cfg.extraSessionCommands}
exec ${pkgs.dbus.dbus-launch} --exit-with-session ${swayPackage}/bin/sway
'';
swayJoined = pkgs.symlinkJoin {
name = "sway-joined";
paths = [ swayWrapped swayPackage ];
};
in {
options.programs.sway-beta = {
enable = mkEnableOption ''
Expand All @@ -20,13 +29,30 @@ in {
'';
};

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.
'';
};

extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
xwayland dmenu
xwayland rxvt_unicode dmenu
];
defaultText = literalExample ''
with pkgs; [ xwayland dmenu ];
with pkgs; [ xwayland rxvt_unicode dmenu ];
'';
example = literalExample ''
with pkgs; [
Expand All @@ -42,7 +68,7 @@ in {
};

config = mkIf cfg.enable {
environment.systemPackages = [ swayPackage ] ++ cfg.extraPackages;
environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages;
security.pam.services.swaylock = {};
hardware.opengl.enable = mkDefault true;
fonts.enableDefaultFonts = mkDefault true;
Expand All @@ -51,4 +77,3 @@ in {

meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ];
}

0 comments on commit f319c7f

Please sign in to comment.