diff options
Diffstat (limited to 'nixpkgs/pkgs/by-name/sw/sway-unwrapped')
5 files changed, 205 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/sw/sway-unwrapped/fix-paths.patch b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/fix-paths.patch new file mode 100644 index 000000000000..c52f65b146b7 --- /dev/null +++ b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/fix-paths.patch @@ -0,0 +1,11 @@ +--- a/sway/config.c ++++ b/sway/config.c +@@ -276,7 +276,7 @@ + + if (!(config->active_bar_modifiers = create_list())) goto cleanup; + +- if (!(config->swaybg_command = strdup("swaybg"))) goto cleanup; ++ if (!(config->swaybg_command = strdup("@swaybg@/bin/swaybg"))) goto cleanup; + + if (!(config->config_chain = create_list())) goto cleanup; + config->current_config_path = NULL; diff --git a/nixpkgs/pkgs/by-name/sw/sway-unwrapped/load-configuration-from-etc.patch b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/load-configuration-from-etc.patch new file mode 100644 index 000000000000..46a170abc04a --- /dev/null +++ b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/load-configuration-from-etc.patch @@ -0,0 +1,48 @@ +From 92283df3acbffa5c1bb21f23cdd686113d905114 Mon Sep 17 00:00:00 2001 +From: Patrick Hilhorst <git@hilhorst.be> +Date: Wed, 31 Mar 2021 21:14:13 +0200 +Subject: [PATCH] Load configs from /etc but fallback to /nix/store + +This change will load all configuration files from /etc, to make it easy +to override them, but fallback to /nix/store/.../etc/sway/config to make +Sway work out-of-the-box with the default configuration on non NixOS +systems. + +Original patch by Michael Weiss, updated for Sway 1.6 by Patrick Hilhorst + +Co-authored-by: Michael Weiss <dev.primeos@gmail.com> +--- + meson.build | 3 ++- + sway/config.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index b7a29660..8ae8ceb3 100644 +--- a/meson.build ++++ b/meson.build +@@ -164,7 +164,8 @@ if scdoc.found() + endforeach + endif + +-add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') ++add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') ++add_project_arguments('-DNIX_SYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir)), language : 'c') + + version = '"@0@"'.format(meson.project_version()) + git = find_program('git', native: true, required: false) +diff --git a/sway/config.c b/sway/config.c +index 76b9ec08..fb5b51aa 100644 +--- a/sway/config.c ++++ b/sway/config.c +@@ -374,7 +374,8 @@ static char *get_config_path(void) { + { .prefix = home, .config_folder = ".i3"}, + { .prefix = config_home, .config_folder = "i3"}, + { .prefix = SYSCONFDIR, .config_folder = "sway"}, +- { .prefix = SYSCONFDIR, .config_folder = "i3"} ++ { .prefix = SYSCONFDIR, .config_folder = "i3"}, ++ { .prefix = NIX_SYSCONFDIR, .config_folder = "sway"}, + }; + + size_t num_config_paths = sizeof(config_paths)/sizeof(config_paths[0]); +-- +2.30.1 diff --git a/nixpkgs/pkgs/by-name/sw/sway-unwrapped/package.nix b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/package.nix new file mode 100644 index 000000000000..452925beeabb --- /dev/null +++ b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/package.nix @@ -0,0 +1,104 @@ +{ lib, stdenv, fetchFromGitHub, fetchpatch, substituteAll, swaybg +, meson, ninja, pkg-config, wayland-scanner, scdoc +, libGL, wayland, libxkbcommon, pcre2, json_c, libevdev +, pango, cairo, libinput, gdk-pixbuf, librsvg +, wlroots_0_16, wayland-protocols, libdrm +, nixosTests +# Used by the NixOS module: +, isNixOS ? false +, enableXWayland ? true, xorg +, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd +, trayEnabled ? systemdSupport +}: + +let + wlroots = wlroots_0_16; +in +stdenv.mkDerivation (finalAttrs: { + pname = "sway-unwrapped"; + version = "1.8.1"; + + inherit enableXWayland isNixOS systemdSupport trayEnabled; + src = fetchFromGitHub { + owner = "swaywm"; + repo = "sway"; + rev = finalAttrs.version; + hash = "sha256-WxnT+le9vneQLFPz2KoBduOI+zfZPhn1fKlaqbPL6/g="; + }; + + patches = [ + ./load-configuration-from-etc.patch + + (substituteAll { + src = ./fix-paths.patch; + inherit swaybg; + }) + + (fetchpatch { + name = "LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.patch"; + url = "https://github.com/swaywm/sway/commit/dee032d0a0ecd958c902b88302dc59703d703c7f.diff"; + hash = "sha256-dx+7MpEiAkxTBnJcsT3/1BO8rYRfNLecXmpAvhqGMD0="; + }) + ] ++ lib.optionals (!finalAttrs.isNixOS) [ + # References to /nix/store/... will get GC'ed which causes problems when + # copying the default configuration: + ./sway-config-no-nix-store-references.patch + ] ++ lib.optionals finalAttrs.isNixOS [ + # Use /run/current-system/sw/share and /etc instead of /nix/store + # references: + ./sway-config-nixos-paths.patch + ]; + + strictDeps = true; + depsBuildBuild = [ + pkg-config + ]; + + nativeBuildInputs = [ + meson ninja pkg-config wayland-scanner scdoc + ]; + + buildInputs = [ + libGL wayland libxkbcommon pcre2 json_c libevdev + pango cairo libinput gdk-pixbuf librsvg + wayland-protocols libdrm + (wlroots.override { inherit (finalAttrs) enableXWayland; }) + ] ++ lib.optionals finalAttrs.enableXWayland [ + xorg.xcbutilwm + ]; + + mesonFlags = let + # The "sd-bus-provider" meson option does not include a "none" option, + # but it is silently ignored iff "-Dtray=disabled". We use "basu" + # (which is not in nixpkgs) instead of "none" to alert us if this + # changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761 + # assert trayEnabled -> systemdSupport && dbusSupport; + + sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; + in + [ "-Dsd-bus-provider=${sd-bus-provider}" ] + ++ lib.optional (!finalAttrs.enableXWayland) "-Dxwayland=disabled" + ++ lib.optional (!finalAttrs.trayEnabled) "-Dtray=disabled" + ; + + passthru.tests.basic = nixosTests.sway; + + meta = with lib; { + description = "An i3-compatible tiling Wayland compositor"; + longDescription = '' + Sway is a tiling Wayland compositor and a drop-in replacement for the i3 + window manager for X11. It works with your existing i3 configuration and + supports most of i3's features, plus a few extras. + Sway allows you to arrange your application windows logically, rather + than spatially. Windows are arranged into a grid by default which + maximizes the efficiency of your screen and can be quickly manipulated + using only the keyboard. + ''; + homepage = "https://swaywm.org"; + changelog = "https://github.com/swaywm/sway/releases/tag/${version}"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ primeos synthetica ]; + mainProgram = "sway"; + }; +}) diff --git a/nixpkgs/pkgs/by-name/sw/sway-unwrapped/sway-config-nixos-paths.patch b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/sway-config-nixos-paths.patch new file mode 100644 index 000000000000..bbb0f722b8bc --- /dev/null +++ b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/sway-config-nixos-paths.patch @@ -0,0 +1,21 @@ +diff --git a/config.in b/config.in +index 08703bef..f3872730 100644 +--- a/config.in ++++ b/config.in +@@ -22,8 +22,8 @@ set $menu dmenu_path | dmenu | xargs swaymsg exec -- + + ### Output configuration + # +-# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) +-output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill ++# Default wallpaper (more resolutions are available in /run/current-system/sw/share/backgrounds/sway/) ++output * bg /run/current-system/sw/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill + # + # Example configuration: + # +@@ -214,4 +214,4 @@ bar { + } + } + +-include @sysconfdir@/sway/config.d/* ++include /etc/sway/config.d/* diff --git a/nixpkgs/pkgs/by-name/sw/sway-unwrapped/sway-config-no-nix-store-references.patch b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/sway-config-no-nix-store-references.patch new file mode 100644 index 000000000000..009c12959430 --- /dev/null +++ b/nixpkgs/pkgs/by-name/sw/sway-unwrapped/sway-config-no-nix-store-references.patch @@ -0,0 +1,21 @@ +diff --git a/config.in b/config.in +--- a/config.in ++++ b/config.in +@@ -21,8 +21,8 @@ set $menu dmenu_path | dmenu | xargs swaymsg exec + + ### Output configuration + # +-# Default wallpaper (more resolutions are available in @datadir@/backgrounds/sway/) +-output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill ++# Default wallpaper ++#output * bg ~/.config/sway/backgrounds/Sway_Wallpaper_Blue_1920x1080.png fill + # + # Example configuration: + # +@@ -213,5 +213,3 @@ bar { + inactive_workspace #32323200 #32323200 #5c5c5c + } + } +- +-include @sysconfdir@/sway/config.d/* + |