sway module: more options
This commit is contained in:
parent
8cfbf2be5b
commit
e18afa63b7
1 changed files with 56 additions and 5 deletions
|
@ -1,13 +1,61 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
{
|
||||
options.programs.sway.enable = mkEnableOption "sway";
|
||||
|
||||
config = mkIf config.programs.sway.enable {
|
||||
environment.systemPackages = [ pkgs.sway pkgs.xwayland ];
|
||||
let
|
||||
cfg = config.programs.sway;
|
||||
sway = pkgs.sway;
|
||||
|
||||
swayWrapped = pkgs.writeScriptBin "sway" ''
|
||||
#! ${pkgs.stdenv.shell}
|
||||
${cfg.extraSessionCommands}
|
||||
PATH="${sway}/bin:$PATH"
|
||||
exec ${pkgs.dbus.dbus-launch} --exit-with-session "${sway}/bin/sway"
|
||||
'';
|
||||
swayJoined = pkgs.symlinkJoin {
|
||||
name = "sway-wrapped";
|
||||
paths = [ swayWrapped sway ];
|
||||
};
|
||||
in
|
||||
{
|
||||
options.programs.sway = {
|
||||
enable = mkEnableOption "sway";
|
||||
|
||||
extraSessionCommands = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
example = ''
|
||||
export XKB_DEFAULT_LAYOUT=us,ru
|
||||
export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,
|
||||
export QT_QPA_PLATFORM=wayland
|
||||
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
||||
'';
|
||||
description = ''
|
||||
Shell commands executed just before sway is started.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = with types; listOf package;
|
||||
default = with pkgs; [ ];
|
||||
example = literalExample ''
|
||||
with pkgs; [
|
||||
i3status
|
||||
xwayland j4-dmenu-desktop dunst
|
||||
qt5.qtwayland
|
||||
imagemagick
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
Extra packages to be installed system wide.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages;
|
||||
security.wrappers.sway = {
|
||||
source = "${pkgs.sway}/bin/sway";
|
||||
source = "${swayJoined}/bin/sway";
|
||||
capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip";
|
||||
owner = "root";
|
||||
group = "sway";
|
||||
|
@ -15,5 +63,8 @@ with lib;
|
|||
};
|
||||
|
||||
users.extraGroups.sway = {};
|
||||
|
||||
hardware.opengl.enable = mkDefault true;
|
||||
fonts.enableDefaultFonts = mkDefault true;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue