mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-15 22:19:17 +03:00
nixos/sway: Extend the default configuration for NixOS
The default config.in template contains "include @sysconfdir@/sway/config.d/*" but we've dropped it to better support non-NixOS (which seems like a mistake in retrospect). This restores that behaviour and extends the default configuration via nixos.conf to fix #119445. Note: The security configurations (security.d) where dropped entirely (but maybe they'll return).
This commit is contained in:
parent
93123faae0
commit
00e8e5b123
3 changed files with 20 additions and 7 deletions
|
@ -31,6 +31,7 @@ let
|
||||||
extraOptions = cfg.extraOptions;
|
extraOptions = cfg.extraOptions;
|
||||||
withBaseWrapper = cfg.wrapperFeatures.base;
|
withBaseWrapper = cfg.wrapperFeatures.base;
|
||||||
withGtkWrapper = cfg.wrapperFeatures.gtk;
|
withGtkWrapper = cfg.wrapperFeatures.gtk;
|
||||||
|
isNixOS = true;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.programs.sway = {
|
options.programs.sway = {
|
||||||
|
@ -120,8 +121,11 @@ in {
|
||||||
systemPackages = [ swayPackage ] ++ cfg.extraPackages;
|
systemPackages = [ swayPackage ] ++ cfg.extraPackages;
|
||||||
etc = {
|
etc = {
|
||||||
"sway/config".source = mkOptionDefault "${swayPackage}/etc/sway/config";
|
"sway/config".source = mkOptionDefault "${swayPackage}/etc/sway/config";
|
||||||
#"sway/security.d".source = mkOptionDefault "${swayPackage}/etc/sway/security.d/";
|
"sway/config.d/nixos.conf".source = pkgs.writeText "nixos.conf" ''
|
||||||
#"sway/config.d".source = mkOptionDefault "${swayPackage}/etc/sway/config.d/";
|
# Import the most important environment variables into the D-Bus and systemd
|
||||||
|
# user environments (e.g. required for screen sharing and Pinentry prompts):
|
||||||
|
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
security.pam.services.swaylock = {};
|
security.pam.services.swaylock = {};
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
, pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
|
, pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
|
||||||
, wlroots, wayland-protocols, libdrm
|
, wlroots, wayland-protocols, libdrm
|
||||||
, nixosTests
|
, nixosTests
|
||||||
|
# Used by the NixOS module:
|
||||||
|
, isNixOS ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
@ -27,6 +29,10 @@ stdenv.mkDerivation rec {
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
postPatch = lib.optionalString isNixOS ''
|
||||||
|
echo -e '\ninclude /etc/sway/config.d/*' >> config.in
|
||||||
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
meson ninja pkg-config wayland scdoc
|
meson ninja pkg-config wayland scdoc
|
||||||
];
|
];
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
, withBaseWrapper ? true, extraSessionCommands ? "", dbus
|
, withBaseWrapper ? true, extraSessionCommands ? "", dbus
|
||||||
, withGtkWrapper ? false, wrapGAppsHook, gdk-pixbuf, glib, gtk3
|
, withGtkWrapper ? false, wrapGAppsHook, gdk-pixbuf, glib, gtk3
|
||||||
, extraOptions ? [] # E.g.: [ "--verbose" ]
|
, extraOptions ? [] # E.g.: [ "--verbose" ]
|
||||||
|
# Used by the NixOS module:
|
||||||
|
, isNixOS ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert extraSessionCommands != "" -> withBaseWrapper;
|
assert extraSessionCommands != "" -> withBaseWrapper;
|
||||||
|
@ -11,6 +13,7 @@ assert extraSessionCommands != "" -> withBaseWrapper;
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
sway = sway-unwrapped.override { inherit isNixOS; };
|
||||||
baseWrapper = writeShellScriptBin "sway" ''
|
baseWrapper = writeShellScriptBin "sway" ''
|
||||||
set -o errexit
|
set -o errexit
|
||||||
if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then
|
if [ ! "$_SWAY_WRAPPER_ALREADY_EXECUTED" ]; then
|
||||||
|
@ -19,16 +22,16 @@ let
|
||||||
fi
|
fi
|
||||||
if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
if [ "$DBUS_SESSION_BUS_ADDRESS" ]; then
|
||||||
export DBUS_SESSION_BUS_ADDRESS
|
export DBUS_SESSION_BUS_ADDRESS
|
||||||
exec ${sway-unwrapped}/bin/sway "$@"
|
exec ${sway}/bin/sway "$@"
|
||||||
else
|
else
|
||||||
exec ${dbus}/bin/dbus-run-session ${sway-unwrapped}/bin/sway "$@"
|
exec ${dbus}/bin/dbus-run-session ${sway}/bin/sway "$@"
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
in symlinkJoin {
|
in symlinkJoin {
|
||||||
name = "sway-${sway-unwrapped.version}";
|
name = "sway-${sway.version}";
|
||||||
|
|
||||||
paths = (optional withBaseWrapper baseWrapper)
|
paths = (optional withBaseWrapper baseWrapper)
|
||||||
++ [ sway-unwrapped ];
|
++ [ sway ];
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ]
|
nativeBuildInputs = [ makeWrapper ]
|
||||||
++ (optional withGtkWrapper wrapGAppsHook);
|
++ (optional withGtkWrapper wrapGAppsHook);
|
||||||
|
@ -48,5 +51,5 @@ in symlinkJoin {
|
||||||
|
|
||||||
passthru.providedSessions = [ "sway" ];
|
passthru.providedSessions = [ "sway" ];
|
||||||
|
|
||||||
inherit (sway-unwrapped) meta;
|
inherit (sway) meta;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue