nixos/sway: Extend the descriptions and examples

This'll hopefully make it a bit easier to get started with Sway and make
some things about the module more obvious.

+31 -19
+31 -19
nixos/modules/programs/sway.nix
··· 4 4 5 5 let 6 6 cfg = config.programs.sway; 7 - sway = pkgs.sway; 7 + swayPackage = pkgs.sway; 8 8 9 9 swayWrapped = pkgs.writeShellScriptBin "sway" '' 10 - if [ "$1" != "" ]; then 11 - sway-setcap "$@" 12 - exit 10 + if [[ "$#" -ge 1 ]]; then 11 + exec sway-setcap "$@" 12 + else 13 + ${cfg.extraSessionCommands} 14 + exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap 13 15 fi 14 - ${cfg.extraSessionCommands} 15 - exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap 16 16 ''; 17 17 swayJoined = pkgs.symlinkJoin { 18 - name = "sway-wrapped"; 19 - paths = [ swayWrapped sway ]; 18 + name = "sway-joined"; 19 + paths = [ swayWrapped swayPackage ]; 20 20 }; 21 - in 22 - { 21 + in { 23 22 options.programs.sway = { 24 - enable = mkEnableOption "sway"; 23 + enable = mkEnableOption '' 24 + the tiling Wayland compositor Sway. After adding yourself to the "sway" 25 + group you can manually launch Sway by executing "sway" from a terminal. 26 + If you call "sway" with any parameters the extraSessionCommands won't be 27 + executed and Sway won't be launched with dbus-launch''; 25 28 26 29 extraSessionCommands = mkOption { 27 - default = ""; 28 - type = types.lines; 30 + type = types.lines; 31 + default = ""; 29 32 example = '' 30 - export XKB_DEFAULT_LAYOUT=us,de 31 - export XKB_DEFAULT_VARIANT=,nodeadkeys 32 - export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle, 33 + # Define a keymap (US QWERTY is the default) 34 + export XKB_DEFAULT_LAYOUT=de,us 35 + export XKB_DEFAULT_VARIANT=nodeadkeys 36 + export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,caps:escape 37 + # Change the Keyboard repeat delay and rate 38 + export WLC_REPEAT_DELAY=660 39 + export WLC_REPEAT_RATE=25 33 40 ''; 34 41 description = '' 35 - Shell commands executed just before sway is started. 42 + Shell commands executed just before Sway is started. 36 43 ''; 37 44 }; 38 45 ··· 41 48 default = with pkgs; [ 42 49 i3status xwayland rxvt_unicode dmenu 43 50 ]; 51 + defaultText = literalExample '' 52 + with pkgs; [ i3status xwayland rxvt_unicode dmenu ]; 53 + ''; 44 54 example = literalExample '' 45 55 with pkgs; [ 46 - i3status xwayland rxvt_unicode dmenu 56 + i3lock light termite 47 57 ] 48 58 ''; 49 59 description = '' ··· 56 66 environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages; 57 67 security.wrappers.sway = { 58 68 program = "sway-setcap"; 59 - source = "${sway}/bin/sway"; 69 + source = "${swayPackage}/bin/sway"; 60 70 capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip"; 61 71 owner = "root"; 62 72 group = "sway"; ··· 70 80 fonts.enableDefaultFonts = mkDefault true; 71 81 programs.dconf.enable = mkDefault true; 72 82 }; 83 + 84 + meta.maintainers = with lib.maintainers; [ gnidorah primeos ]; 73 85 }