3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/programs/sway-beta.nix

80 lines
2.2 KiB
Nix
Raw Normal View History

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" ''
${cfg.extraSessionCommands}
exec ${pkgs.dbus.dbus-launch} --exit-with-session ${swayPackage}/bin/sway "$@"
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 ];
}