mirror of
https://github.com/nix-community/home-manager
synced 2024-06-13 18:23:39 +02:00
Merge d38eb6f154
into 6d3b6dc922
This commit is contained in:
commit
8cf22028a1
|
@ -258,7 +258,6 @@ let
|
||||||
|
|
||||||
variables = concatStringsSep " " cfg.systemd.variables;
|
variables = concatStringsSep " " cfg.systemd.variables;
|
||||||
extraCommands = concatStringsSep " && " cfg.systemd.extraCommands;
|
extraCommands = concatStringsSep " && " cfg.systemd.extraCommands;
|
||||||
swayPackage = if cfg.package == null then pkgs.sway else cfg.package;
|
|
||||||
systemdActivation = ''
|
systemdActivation = ''
|
||||||
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}"'';
|
exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables}; ${extraCommands}"'';
|
||||||
|
|
||||||
|
@ -269,7 +268,7 @@ let
|
||||||
checkPhase = lib.optionalString cfg.checkConfig ''
|
checkPhase = lib.optionalString cfg.checkConfig ''
|
||||||
export DBUS_SESSION_BUS_ADDRESS=/dev/null
|
export DBUS_SESSION_BUS_ADDRESS=/dev/null
|
||||||
export XDG_RUNTIME_DIR=$(mktemp -d)
|
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"
|
text = concatStringsSep "\n"
|
||||||
|
@ -331,13 +330,6 @@ let
|
||||||
++ [ cfg.extraConfig ]);
|
++ [ cfg.extraConfig ]);
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultSwayPackage = pkgs.sway.override {
|
|
||||||
extraSessionCommands = cfg.extraSessionCommands;
|
|
||||||
extraOptions = cfg.extraOptions;
|
|
||||||
withBaseWrapper = cfg.wrapperFeatures.base;
|
|
||||||
withGtkWrapper = cfg.wrapperFeatures.gtk;
|
|
||||||
};
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with maintainers; [
|
meta.maintainers = with maintainers; [
|
||||||
Scrumplex
|
Scrumplex
|
||||||
|
@ -357,14 +349,20 @@ in {
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = with types; nullOr package;
|
type = with types; nullOr package;
|
||||||
default = defaultSwayPackage;
|
default = pkgs.sway.override {
|
||||||
|
extraSessionCommands = cfg.extraSessionCommands;
|
||||||
|
extraOptions = cfg.extraOptions;
|
||||||
|
withBaseWrapper = cfg.wrapperFeatures.base;
|
||||||
|
withGtkWrapper = cfg.wrapperFeatures.gtk;
|
||||||
|
};
|
||||||
defaultText = literalExpression "${pkgs.sway}";
|
defaultText = literalExpression "${pkgs.sway}";
|
||||||
description = ''
|
description = ''
|
||||||
Sway package to use. Will override the options
|
Sway package to use. Will override the options
|
||||||
'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'.
|
'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'.
|
||||||
Set to `null` to not add any Sway package to your
|
Set to `null` to not add any Sway package to your
|
||||||
path. This should be done if you want to use the NixOS Sway
|
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.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -480,9 +478,9 @@ in {
|
||||||
|
|
||||||
checkConfig = mkOption {
|
checkConfig = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = cfg.package != null;
|
||||||
description =
|
defaultText = literalExpression "cfg.package != null";
|
||||||
"If enabled (the default), validates the generated config file.";
|
description = "If enabled, validates the generated config file.";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
|
@ -517,6 +515,11 @@ in {
|
||||||
assertions = [
|
assertions = [
|
||||||
(hm.assertions.assertPlatform "wayland.windowManager.sway" pkgs
|
(hm.assertions.assertPlatform "wayland.windowManager.sway" pkgs
|
||||||
platforms.linux)
|
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
|
home.packages = optional (cfg.package != null) cfg.package
|
||||||
|
@ -524,10 +527,10 @@ in {
|
||||||
|
|
||||||
xdg.configFile."sway/config" = {
|
xdg.configFile."sway/config" = {
|
||||||
source = configFile;
|
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"
|
swaySocket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep --uid $UID -x sway || true).sock"
|
||||||
if [ -S "$swaySocket" ]; then
|
if [ -S "$swaySocket" ]; then
|
||||||
${swayPackage}/bin/swaymsg -s $swaySocket reload
|
${cfg.package}/bin/swaymsg -s $swaySocket reload
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user