Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

nixos/sway: Improve the module and adapt it to NixOS

This commit contains the following changes:
- nixos/sway: Remove the beta references
- sway: Drop buildDocs
- nixos/sway: Improve the documentation
- sway,nixos/sway: Adapt Sway to NixOS
- Copy the default configuration file to /etc/sway/config (Sway will
still load the identical file from the Nix store but this makes it
easier to copy the default configuration file).
- This will also remove all references to the Nix store from the
default configuration file as they will eventually be garbage
collected which is a problem if the user copies it.
- I've also decided to drop the default wallpaper (alternatively we
could copy it to a fixed location).
- nixos/sway: Drop the package option

(cherry picked from commit 578fe3f5a02f855c5d1ad14e2440b9359a750c40)

+44 -22
+17 -15
nixos/modules/programs/sway.nix
··· 3 3 with lib; 4 4 5 5 let 6 - cfg = config.programs.sway-beta; 7 - swayPackage = cfg.package; 6 + cfg = config.programs.sway; 7 + swayPackage = pkgs.sway; 8 8 9 9 swayWrapped = pkgs.writeShellScriptBin "sway" '' 10 10 set -o errexit ··· 26 26 paths = [ swayWrapped swayPackage ]; 27 27 }; 28 28 in { 29 - options.programs.sway-beta = { 29 + options.programs.sway = { 30 30 enable = mkEnableOption '' 31 - Sway, the i3-compatible tiling Wayland compositor. This module will be removed after the final release of Sway 1.0 32 - ''; 33 - 34 - package = mkOption { 35 - type = types.package; 36 - default = pkgs.sway-beta; 37 - defaultText = "pkgs.sway-beta"; 38 - description = '' 39 - The package to be used for `sway`. 40 - ''; 41 - }; 31 + Sway, the i3-compatible tiling Wayland compositor. You can manually launch 32 + Sway by executing "exec sway" on a TTY. Copy /etc/sway/config to 33 + ~/.config/sway/config to modify the default configuration. See 34 + https://github.com/swaywm/sway/wiki and "man 5 sway" for more information. 35 + Please have a look at the "extraSessionCommands" example for running 36 + programs natively under Wayland''; 42 37 43 38 extraSessionCommands = mkOption { 44 39 type = types.lines; ··· 80 75 }; 81 76 82 77 config = mkIf cfg.enable { 83 - environment.systemPackages = [ swayJoined ] ++ cfg.extraPackages; 78 + environment = { 79 + systemPackages = [ swayJoined ] ++ cfg.extraPackages; 80 + etc = { 81 + "sway/config".source = "${swayPackage}/etc/sway/config"; 82 + #"sway/security.d".source = "${swayPackage}/etc/sway/security.d/"; 83 + #"sway/config.d".source = "${swayPackage}/etc/sway/config.d/"; 84 + }; 85 + }; 84 86 security.pam.services.swaylock = {}; 85 87 hardware.opengl.enable = mkDefault true; 86 88 fonts.enableDefaultFonts = mkDefault true;
+6 -7
pkgs/applications/window-managers/sway/default.nix
··· 4 4 , wayland, libxkbcommon, pcre, json_c, dbus, libevdev 5 5 , pango, cairo, libinput, libcap, pam, gdk_pixbuf 6 6 , wlroots, wayland-protocols 7 - , buildDocs ? true 8 7 }: 9 8 10 9 stdenv.mkDerivation rec { ··· 26 25 url = "https://github.com/swaywm/sway/commit/bcde298a719f60b9913133dbd2a169dedbc8dd7d.patch"; 27 26 sha256 = "0r583nmqvq43ib93yv6flw8pj833v32lbs0q0xld56s3rnzvvdcp"; 28 27 }) 28 + ./sway-config-no-nix-store-references.patch 29 29 ]; 30 30 31 - nativeBuildInputs = [ 32 - pkgconfig meson ninja 33 - ] ++ stdenv.lib.optional buildDocs scdoc; 31 + nativeBuildInputs = [ pkgconfig meson ninja scdoc ]; 34 32 35 33 buildInputs = [ 36 34 wayland libxkbcommon pcre json_c dbus libevdev ··· 41 39 enableParallelBuilding = true; 42 40 43 41 mesonFlags = [ 44 - "-Dxwayland=enabled" "-Dgdk-pixbuf=enabled" "-Dtray=enabled" 45 - ] ++ stdenv.lib.optional buildDocs "-Dman-pages=enabled"; 42 + "-Ddefault-wallpaper=false" "-Dxwayland=enabled" "-Dgdk-pixbuf=enabled" 43 + "-Dtray=enabled" "-Dman-pages=enabled" 44 + ]; 46 45 47 46 meta = with stdenv.lib; { 48 - description = "i3-compatible window manager for Wayland"; 47 + description = "i3-compatible tiling Wayland compositor"; 49 48 homepage = https://swaywm.org; 50 49 license = licenses.mit; 51 50 platforms = platforms.linux;
+21
pkgs/applications/window-managers/sway/sway-config-no-nix-store-references.patch
··· 1 + diff --git a/config.in b/config.in 2 + --- a/config.in 3 + +++ b/config.in 4 + @@ -21,8 +21,8 @@ set $menu dmenu_path | dmenu | xargs swaymsg exec 5 + 6 + ### Output configuration 7 + # 8 + -# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) 9 + -output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill 10 + +# Default wallpaper 11 + +#output * bg ~/.config/sway/backgrounds/Sway_Wallpaper_Blue_1920x1080.png fill 12 + # 13 + # Example configuration: 14 + # 15 + @@ -213,5 +213,3 @@ bar { 16 + inactive_workspace #32323200 #32323200 #5c5c5c 17 + } 18 + } 19 + - 20 + -include @sysconfdir@/sway/config.d/* 21 +