1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-26 00:18:30 +02:00

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.
This commit is contained in:
Alex Rice 2020-06-01 14:54:21 +01:00 committed by Robert Helgesson
parent 479274775f
commit 2dbe637478
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89

View File

@ -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 <code>null</code> 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
'';
};