sway: do not use pkgs.sway
when cfg.package = null
- Implicitly disable checkConfig when `cfg.package = null` as we don’t have any exe to use for the check - Implicitly disable `swaymsg reload` on activation, since we have no exe to use for running it See https://github.com/nix-community/home-manager/issues/5307
This commit is contained in:
parent
4f2750740e
commit
d38eb6f154
|
@ -258,7 +258,6 @@ let
|
|||
|
||||
variables = concatStringsSep " " cfg.systemd.variables;
|
||||
extraCommands = concatStringsSep " && " cfg.systemd.extraCommands;
|
||||
swayPackage = if cfg.package == null then pkgs.sway else cfg.package;
|
||||
systemdActivation = ''
|
||||
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}"'';
|
||||
|
||||
|
@ -269,7 +268,7 @@ let
|
|||
checkPhase = lib.optionalString cfg.checkConfig ''
|
||||
export DBUS_SESSION_BUS_ADDRESS=/dev/null
|
||||
export XDG_RUNTIME_DIR=$(mktemp -d)
|
||||
${pkgs.xvfb-run}/bin/xvfb-run ${swayPackage}/bin/sway --config "$target" --validate --unsupported-gpu
|
||||
${pkgs.xvfb-run}/bin/xvfb-run ${cfg.package}/bin/sway --config "$target" --validate --unsupported-gpu
|
||||
'';
|
||||
|
||||
text = concatStringsSep "\n"
|
||||
|
@ -362,7 +361,8 @@ in {
|
|||
'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.
|
||||
module to install Sway. Beware setting to `null` will also disable
|
||||
reloading Sway when new config is activated.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -478,9 +478,9 @@ in {
|
|||
|
||||
checkConfig = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description =
|
||||
"If enabled (the default), validates the generated config file.";
|
||||
default = cfg.package != null;
|
||||
defaultText = literalExpression "cfg.package != null";
|
||||
description = "If enabled, validates the generated config file.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
|
@ -515,6 +515,11 @@ in {
|
|||
assertions = [
|
||||
(hm.assertions.assertPlatform "wayland.windowManager.sway" pkgs
|
||||
platforms.linux)
|
||||
{
|
||||
assertion = cfg.checkConfig -> cfg.package != null;
|
||||
message =
|
||||
"programs.sway.checkConfig requires non-null programs.sway.package";
|
||||
}
|
||||
];
|
||||
|
||||
home.packages = optional (cfg.package != null) cfg.package
|
||||
|
@ -522,10 +527,10 @@ in {
|
|||
|
||||
xdg.configFile."sway/config" = {
|
||||
source = configFile;
|
||||
onChange = ''
|
||||
onChange = lib.optionalString (cfg.package != null) ''
|
||||
swaySocket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep --uid $UID -x sway || true).sock"
|
||||
if [ -S "$swaySocket" ]; then
|
||||
${swayPackage}/bin/swaymsg -s $swaySocket reload
|
||||
${cfg.package}/bin/swaymsg -s $swaySocket reload
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue