diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix index e2a4018e902..33e252be45f 100644 --- a/nixos/modules/programs/sway.nix +++ b/nixos/modules/programs/sway.nix @@ -28,6 +28,7 @@ let swayPackage = pkgs.sway.override { extraSessionCommands = cfg.extraSessionCommands; + extraOptions = cfg.extraOptions; withBaseWrapper = cfg.wrapperFeatures.base; withGtkWrapper = cfg.wrapperFeatures.gtk; }; @@ -67,6 +68,21 @@ in { ''; }; + extraOptions = mkOption { + type = types.listOf types.str; + default = []; + example = [ + "--verbose" + "--debug" + "--unsupported-gpu" + "--my-next-gpu-wont-be-nvidia" + ]; + description = '' + Command line arguments passed to launch Sway. Please DO NOT report + issues if you use an unsupported GPU (proprietary drivers). + ''; + }; + extraPackages = mkOption { type = with types; listOf package; default = with pkgs; [ diff --git a/pkgs/applications/window-managers/sway/wrapper.nix b/pkgs/applications/window-managers/sway/wrapper.nix index bd59ac5fa45..7c59b8b7cde 100644 --- a/pkgs/applications/window-managers/sway/wrapper.nix +++ b/pkgs/applications/window-managers/sway/wrapper.nix @@ -3,6 +3,7 @@ , makeWrapper, symlinkJoin, writeShellScriptBin , withBaseWrapper ? true, extraSessionCommands ? "", dbus , withGtkWrapper ? false, wrapGAppsHook, gdk-pixbuf +, extraOptions ? [] # E.g.: [ "--verbose" ] }: assert extraSessionCommands != "" -> withBaseWrapper; @@ -39,9 +40,9 @@ in symlinkJoin { export dontWrapGApps=true ${optionalString withGtkWrapper "wrapGAppsHook"} wrapProgram $out/bin/sway \ - --prefix PATH : "${swaybg}/bin" ${optionalString withGtkWrapper ''\ - "''${gappsWrapperArgs[@]}" - ''} + --prefix PATH : "${swaybg}/bin" \ + ${optionalString withGtkWrapper ''"''${gappsWrapperArgs[@]}"''} \ + ${optionalString (extraOptions != []) "${concatMapStrings (x: " --add-flags " + x) extraOptions}"} ''; passthru.providedSessions = [ "sway" ];