forked from mirrors/nixpkgs
Merge pull request #127367 from oxalica/fix/dm-only-autostart
nixos/desktop-manager/none: add option to run XDG autostart files
This commit is contained in:
commit
353ba1b6e1
|
@ -1852,6 +1852,29 @@
|
|||
configuration.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
The option
|
||||
<link linkend="opt-services.xserver.desktopManager.runXdgAutostartIfNone">services.xserver.desktopManager.runXdgAutostartIfNone</link>
|
||||
was added in order to automatically run XDG autostart files
|
||||
for sessions without a desktop manager. This replaces helpers
|
||||
like the <literal>dex</literal> package.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
When setting
|
||||
<link linkend="opt-i18n.inputMethod.enabled">i18n.inputMethod.enabled</link>
|
||||
to <literal>fcitx5</literal>, it no longer creates
|
||||
corresponding systemd user services. It now relies on XDG
|
||||
autostart files to start and work properly in your desktop
|
||||
sessions. If you are using only a window manager without a
|
||||
desktop manager, you need to enable
|
||||
<literal>services.xserver.desktopManager.runXdgAutostartIfNone</literal>
|
||||
or using the <literal>dex</literal> package to make
|
||||
<literal>fcitx5</literal> work.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
A new module was added for the Envoy reverse proxy, providing
|
||||
|
|
|
@ -693,6 +693,17 @@ In addition to numerous new and upgraded packages, this release has the followin
|
|||
|
||||
- The `services.stubby` module was converted to a [settings-style](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md) configuration.
|
||||
|
||||
- The option
|
||||
[services.xserver.desktopManager.runXdgAutostartIfNone](#opt-services.xserver.desktopManager.runXdgAutostartIfNone)
|
||||
was added in order to automatically run XDG autostart files for sessions without a desktop manager.
|
||||
This replaces helpers like the `dex` package.
|
||||
|
||||
- When setting [i18n.inputMethod.enabled](#opt-i18n.inputMethod.enabled) to `fcitx5`,
|
||||
it no longer creates corresponding systemd user services.
|
||||
It now relies on XDG autostart files to start and work properly in your desktop sessions.
|
||||
If you are using only a window manager without a desktop manager, you need to enable
|
||||
`services.xserver.desktopManager.runXdgAutostartIfNone` or using the `dex` package to make `fcitx5` work.
|
||||
|
||||
- A new module was added for the Envoy reverse proxy, providing the options `services.envoy.enable` and `services.envoy.settings`.
|
||||
|
||||
- The option `services.duplicati.dataDir` has been added to allow changing the location of duplicati's files.
|
||||
|
|
|
@ -28,11 +28,5 @@ in {
|
|||
QT_IM_MODULE = "fcitx";
|
||||
XMODIFIERS = "@im=fcitx";
|
||||
};
|
||||
|
||||
systemd.user.services.fcitx5-daemon = {
|
||||
enable = true;
|
||||
script = "${fcitx5Package}/bin/fcitx5";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,46 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
runXdgAutostart = config.services.xserver.desktopManager.runXdgAutostartIfNone;
|
||||
in
|
||||
{
|
||||
services.xserver.desktopManager.session =
|
||||
[ { name = "none";
|
||||
start = "";
|
||||
}
|
||||
];
|
||||
options = {
|
||||
services.xserver.desktopManager.runXdgAutostartIfNone = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to run XDG autostart files for sessions without a desktop manager
|
||||
(with only a window manager), these sessions usually don't handle XDG
|
||||
autostart files by default.
|
||||
|
||||
Some services like <option>i18n.inputMethod</option> and
|
||||
<option>service.earlyoom</option> use XDG autostart files to start.
|
||||
If this option is not set to <literal>true</literal> and you are using
|
||||
a window manager without a desktop manager, you need to manually start
|
||||
them or running <package>dex</package> somewhere.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge [
|
||||
{
|
||||
services.xserver.desktopManager.session = [
|
||||
{
|
||||
name = "none";
|
||||
start = optionalString runXdgAutostart ''
|
||||
/run/current-system/systemd/bin/systemctl --user start xdg-autostart-if-no-desktop-manager.target
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
(mkIf runXdgAutostart {
|
||||
systemd.user.targets.xdg-autostart-if-no-desktop-manager = {
|
||||
description = "Run XDG autostart files";
|
||||
# From `plasma-workspace`, `share/systemd/user/plasma-workspace@.target`.
|
||||
requires = [ "xdg-desktop-autostart.target" "graphical-session.target" ];
|
||||
before = [ "xdg-desktop-autostart.target" "graphical-session.target" ];
|
||||
bindsTo = [ "graphical-session.target" ];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -594,6 +594,7 @@ in
|
|||
xautolock = handleTest ./xautolock.nix {};
|
||||
xfce = handleTest ./xfce.nix {};
|
||||
xmonad = handleTest ./xmonad.nix {};
|
||||
xmonad-xdg-autostart = handleTest ./xmonad-xdg-autostart.nix {};
|
||||
xrdp = handleTest ./xrdp.nix {};
|
||||
xss-lock = handleTest ./xss-lock.nix {};
|
||||
xterm = handleTest ./xterm.nix {};
|
||||
|
|
35
nixos/tests/xmonad-xdg-autostart.nix
Normal file
35
nixos/tests/xmonad-xdg-autostart.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
import ./make-test-python.nix ({ lib, ... }: {
|
||||
name = "xmonad-xdg-autostart";
|
||||
meta.maintainers = with lib.maintainers; [ oxalica ];
|
||||
|
||||
nodes.machine = { pkgs, config, ... }: {
|
||||
imports = [ ./common/x11.nix ./common/user-account.nix ];
|
||||
test-support.displayManager.auto.user = "alice";
|
||||
services.xserver.displayManager.defaultSession = "none+xmonad";
|
||||
services.xserver.windowManager.xmonad.enable = true;
|
||||
services.xserver.desktopManager.runXdgAutostartIfNone = true;
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeTextFile {
|
||||
name = "test-xdg-autostart";
|
||||
destination = "/etc/xdg/autostart/test-xdg-autostart.desktop";
|
||||
text = ''
|
||||
[Desktop Entry]
|
||||
Name=test-xdg-autoatart
|
||||
Type=Application
|
||||
Terminal=false
|
||||
Exec=${pkgs.coreutils}/bin/touch ${config.users.users.alice.home}/xdg-autostart-executed
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
testScript = { nodes, ... }:
|
||||
let
|
||||
user = nodes.machine.config.users.users.alice;
|
||||
in
|
||||
''
|
||||
machine.wait_for_x()
|
||||
machine.wait_for_file("${user.home}/xdg-autostart-executed")
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue