From 2dbe637478203283ab14b05aa4493929bf7dd62f Mon Sep 17 00:00:00 2001 From: Alex Rice Date: Mon, 1 Jun 2020 14:54:21 +0100 Subject: [PATCH] sway: allow package to be null This allows the `sway.package` option to be null so that the module can be used alongside the nixos module. --- modules/services/window-managers/i3-sway/sway.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 91bfe0fad..8c8b179c1 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -302,11 +302,15 @@ in { enable = mkEnableOption "sway wayland compositor"; package = mkOption { - type = types.package; + type = with types; nullOr package; default = defaultSwayPackage; defaultText = literalExample "${pkgs.sway}"; description = '' - Sway package to use. Will override the options 'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'. + Sway package to use. Will override the options + 'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'. + Set to null to not add any Sway package to your + path. This should be done if you want to use the NixOS Sway + module to install Sway. ''; }; @@ -385,14 +389,15 @@ in { }; config = mkIf cfg.enable { - home.packages = [ cfg.package ] ++ optional cfg.xwayland pkgs.xwayland; + home.packages = optional (cfg.package != null) cfg.package + ++ optional cfg.xwayland pkgs.xwayland; xdg.configFile."sway/config" = { source = configFile; onChange = '' swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway).sock if [ -S $swaySocket ]; then echo "Reloading sway" - $DRY_RUN_CMD ${cfg.package}/bin/swaymsg -s $swaySocket reload + $DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload fi ''; };