diff options
author | Michael Weiss <dev.primeos@gmail.com> | 2017-12-23 21:03:06 +0100 |
---|---|---|
committer | Michael Weiss <dev.primeos@gmail.com> | 2017-12-25 00:15:06 +0100 |
commit | 4be298bf6d517a87ccafb15d8f3d9534a1c27868 (patch) | |
tree | 6cc405b4145472649712d02e521a6d399c0cf837 /nixos/modules/programs | |
parent | ae03a11c86398dd5eee048b13f0430ace00408be (diff) | |
download | nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.tar nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.tar.gz nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.tar.bz2 nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.tar.lz nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.tar.xz nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.tar.zst nixlib-4be298bf6d517a87ccafb15d8f3d9534a1c27868.zip |
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.
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/sway.nix | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix index 98257846d02f..d9503d6004ff 100644 --- a/nixos/modules/programs/sway.nix +++ b/nixos/modules/programs/sway.nix @@ -4,35 +4,42 @@ with lib; let cfg = config.programs.sway; - sway = pkgs.sway; + swayPackage = pkgs.sway; swayWrapped = pkgs.writeShellScriptBin "sway" '' - if [ "$1" != "" ]; then - sway-setcap "$@" - exit + if [[ "$#" -ge 1 ]]; then + exec sway-setcap "$@" + else + ${cfg.extraSessionCommands} + exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap fi - ${cfg.extraSessionCommands} - exec ${pkgs.dbus.dbus-launch} --exit-with-session sway-setcap ''; swayJoined = pkgs.symlinkJoin { - name = "sway-wrapped"; - paths = [ swayWrapped sway ]; + name = "sway-joined"; + paths = [ swayWrapped swayPackage ]; }; -in -{ +in { options.programs.sway = { - enable = mkEnableOption "sway"; + enable = mkEnableOption '' + the tiling Wayland compositor Sway. After adding yourself to the "sway" + group you can manually launch Sway by executing "sway" from a terminal. + If you call "sway" with any parameters the extraSessionCommands won't be + executed and Sway won't be launched with dbus-launch''; extraSessionCommands = mkOption { - default = ""; - type = types.lines; + type = types.lines; + default = ""; example = '' - export XKB_DEFAULT_LAYOUT=us,de - export XKB_DEFAULT_VARIANT=,nodeadkeys - export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle, + # Define a keymap (US QWERTY is the default) + export XKB_DEFAULT_LAYOUT=de,us + export XKB_DEFAULT_VARIANT=nodeadkeys + export XKB_DEFAULT_OPTIONS=grp:alt_shift_toggle,caps:escape + # Change the Keyboard repeat delay and rate + export WLC_REPEAT_DELAY=660 + export WLC_REPEAT_RATE=25 ''; description = '' - Shell commands executed just before sway is started. + Shell commands executed just before Sway is started. ''; }; @@ -41,9 +48,12 @@ in default = with pkgs; [ i3status xwayland rxvt_unicode dmenu ]; + defaultText = literalExample '' + with pkgs; [ i3status xwayland rxvt_unicode dmenu ]; + ''; example = literalExample '' with pkgs; [ - i3status xwayland rxvt_unicode dmenu + i3lock light termite ] ''; description = '' @@ -56,7 +66,7 @@ in environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages; security.wrappers.sway = { program = "sway-setcap"; - source = "${sway}/bin/sway"; + source = "${swayPackage}/bin/sway"; capabilities = "cap_sys_ptrace,cap_sys_tty_config=eip"; owner = "root"; group = "sway"; @@ -70,4 +80,6 @@ in fonts.enableDefaultFonts = mkDefault true; programs.dconf.enable = mkDefault true; }; + + meta.maintainers = with lib.maintainers; [ gnidorah primeos ]; } |