1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01: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"; enable = mkEnableOption "sway wayland compositor";
package = mkOption { package = mkOption {
type = types.package; type = with types; nullOr package;
default = defaultSwayPackage; default = defaultSwayPackage;
defaultText = literalExample "${pkgs.sway}"; defaultText = literalExample "${pkgs.sway}";
description = '' 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 { 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" = { xdg.configFile."sway/config" = {
source = configFile; source = configFile;
onChange = '' onChange = ''
swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway).sock swaySocket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep -x sway).sock
if [ -S $swaySocket ]; then if [ -S $swaySocket ]; then
echo "Reloading sway" echo "Reloading sway"
$DRY_RUN_CMD ${cfg.package}/bin/swaymsg -s $swaySocket reload $DRY_RUN_CMD ${pkgs.sway}/bin/swaymsg -s $swaySocket reload
fi fi
''; '';
}; };