mirror of
https://github.com/nix-community/home-manager
synced 2024-11-01 00:39:45 +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:
parent
479274775f
commit
2dbe637478
1 changed files with 9 additions and 4 deletions
|
@ -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
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue