summary refs log tree commit diff
path: root/pkgs/applications/window-managers
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-05-11 18:51:43 +0200
committerMichael Weiss <dev.primeos@gmail.com>2021-05-11 18:53:49 +0200
commit00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93 (patch)
treefc38df317651b5e3c2f7d9521b04e1261fc14954 /pkgs/applications/window-managers
parent93123faae0281d2e97d12641a7cfad07c8028aff (diff)
downloadnixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.tar
nixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.tar.gz
nixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.tar.bz2
nixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.tar.lz
nixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.tar.xz
nixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.tar.zst
nixpkgs-00e8e5b123f8f8a29b88f7f06ceb9f0b48c86c93.zip
nixos/sway: Extend the default configuration for NixOS
The default config.in template contains
"include @sysconfdir@/sway/config.d/*" but we've dropped it to better
support non-NixOS (which seems like a mistake in retrospect).
This restores that behaviour and extends the default configuration via
nixos.conf to fix #119445.

Note: The security configurations (security.d) where dropped entirely
(but maybe they'll return).
Diffstat (limited to 'pkgs/applications/window-managers')
-rw-r--r--pkgs/applications/window-managers/sway/default.nix6
-rw-r--r--pkgs/applications/window-managers/sway/wrapper.nix13
2 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/applications/window-managers/sway/default.nix b/pkgs/applications/window-managers/sway/default.nix
index 2636d9100d5..03abea94a2e 100644
--- a/pkgs/applications/window-managers/sway/default.nix
+++ b/pkgs/applications/window-managers/sway/default.nix
@@ -4,6 +4,8 @@
 , pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
 , wlroots, wayland-protocols, libdrm
 , nixosTests
+# Used by the NixOS module:
+, isNixOS ? false
 }:
 
 stdenv.mkDerivation rec {
@@ -27,6 +29,10 @@ stdenv.mkDerivation rec {
     })
   ];
 
+  postPatch = lib.optionalString isNixOS ''
+    echo -e '\ninclude /etc/sway/config.d/*' >> config.in
+  '';
+
   nativeBuildInputs = [
     meson ninja pkg-config wayland scdoc
   ];
diff --git a/pkgs/applications/window-managers/sway/wrapper.nix b/pkgs/applications/window-managers/sway/wrapper.nix
index 319023eb2e5..e83d4e7d628 100644
--- a/pkgs/applications/window-managers/sway/wrapper.nix
+++ b/pkgs/applications/window-managers/sway/wrapper.nix
@@ -4,6 +4,8 @@
 , withBaseWrapper ? true, extraSessionCommands ? "", dbus
 , withGtkWrapper ? false, wrapGAppsHook, gdk-pixbuf, glib, gtk3
 , extraOptions ? [] # E.g.: [ "--verbose" ]
+# Used by the NixOS module:
+, isNixOS ? false
 }:
 
 assert extraSessionCommands != "" -> withBaseWrapper;
@@ -11,6 +13,7 @@ assert extraSessionCommands != "" -> withBaseWrapper;
 with lib;
 
 let
+  sway = sway-unwrapped.override { inherit isNixOS; };
   baseWrapper = writeShellScriptBin "sway" ''
      set -o errexit
      if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then
@@ -19,16 +22,16 @@ let
      fi
      if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then
        export DBUS_SESSION_BUS_ADDRESS
-       exec ${sway-unwrapped}/bin/sway "$@"
+       exec ${sway}/bin/sway "$@"
      else
-       exec ${dbus}/bin/dbus-run-session ${sway-unwrapped}/bin/sway "$@"
+       exec ${dbus}/bin/dbus-run-session ${sway}/bin/sway "$@"
      fi
    '';
 in symlinkJoin {
-  name = "sway-${sway-unwrapped.version}";
+  name = "sway-${sway.version}";
 
   paths = (optional withBaseWrapper baseWrapper)
-    ++ [ sway-unwrapped ];
+    ++ [ sway ];
 
   nativeBuildInputs = [ makeWrapper ]
     ++ (optional withGtkWrapper wrapGAppsHook);
@@ -48,5 +51,5 @@ in symlinkJoin {
 
   passthru.providedSessions = [ "sway" ];
 
-  inherit (sway-unwrapped) meta;
+  inherit (sway) meta;
 }