Skip to content

Commit 429b7a7

Browse files
committed
Revert "Merge pull request NixOS#73251 which removes SLiM DM"
This reverts commit 4583e29, reversing changes made to d6fa540. The fact that SLiM is not officially actively maintained is not a good reason to remove it. It works, and, in some instances, like automatic logins, it is the only thing that actually works. See NixOS#46396 and NixOS#30890 (comment).
1 parent 349b471 commit 429b7a7

File tree

21 files changed

+681
-31
lines changed

21 files changed

+681
-31
lines changed

nixos/doc/manual/configuration/x-windows.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
can select an alternative one by picking one of the following lines:
4040
<programlisting>
4141
<xref linkend="opt-services.xserver.displayManager.sddm.enable"/> = true;
42-
<xref linkend="opt-services.xserver.displayManager.gdm.enable"/> = true;
42+
<xref linkend="opt-services.xserver.displayManager.slim.enable"/> = true;
4343
</programlisting>
4444
</para>
4545
<para>

nixos/doc/manual/development/option-declarations.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ xlink:href="https://nixos.org/nixpkgs/manual/#sec-package-naming">
9999
<para>
100100
As an example, we will take the case of display managers. There is a central
101101
display manager module for generic display manager options and a module file
102-
per display manager backend (sddm, gdm ...).
102+
per display manager backend (slim, sddm, gdm ...).
103103
</para>
104104

105105
<para>
@@ -146,7 +146,7 @@ xlink:href="https://nixos.org/nixpkgs/manual/#sec-package-naming">
146146
/>), and to extend
147147
it in each backend module
148148
(<xref
149-
linkend='ex-option-declaration-eot-backend-gdm' />,
149+
linkend='ex-option-declaration-eot-backend-slim' />,
150150
<xref
151151
linkend='ex-option-declaration-eot-backend-sddm' />).
152152
</para>
@@ -167,11 +167,11 @@ services.xserver.displayManager.enable = mkOption {
167167
};</screen>
168168
</example>
169169

170-
<example xml:id='ex-option-declaration-eot-backend-gdm'>
171-
<title>Extending <literal>services.xserver.displayManager.enable</literal> in the <literal>gdm</literal> module</title>
170+
<example xml:id='ex-option-declaration-eot-backend-slim'>
171+
<title>Extending <literal>services.xserver.displayManager.enable</literal> in the <literal>slim</literal> module</title>
172172
<screen>
173173
services.xserver.displayManager.enable = mkOption {
174-
type = with types; nullOr (enum [ "gdm" ]);
174+
type = with types; nullOr (enum [ "slim" ]);
175175
};</screen>
176176
</example>
177177

nixos/doc/manual/release-notes/rl-2003.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ services.xserver.displayManager.defaultSession = "xfce+icewm";
175175
Now, all bash code is held to the same high standard, and the rather complex stateful manipulation of the options can be discarded.
176176
</para>
177177
</listitem>
178-
<listitem>
179-
<para>
180-
The SLIM Display Manager has been removed, as it has been unmaintained since 2013.
181-
Consider migrating to a different display manager such as LightDM (current default in NixOS),
182-
SDDM, GDM, or using the startx module which uses Xinitrc.
183-
</para>
184-
</listitem>
185178
<listitem>
186179
<para>
187180
The Way Cooler wayland compositor has been removed, as the project has been officially canceled.

nixos/lib/testing-python.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ in rec {
265265
inherit require;
266266
virtualisation.memorySize = 1024;
267267
services.xserver.enable = true;
268+
services.xserver.displayManager.slim.enable = false;
268269
services.xserver.displayManager.auto.enable = true;
269270
services.xserver.displayManager.defaultSession = "none+icewm";
270271
services.xserver.windowManager.icewm.enable = true;

nixos/lib/testing.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ in rec {
248248
inherit require;
249249
virtualisation.memorySize = 1024;
250250
services.xserver.enable = true;
251+
services.xserver.displayManager.slim.enable = false;
251252
services.xserver.displayManager.auto.enable = true;
252253
services.xserver.displayManager.defaultSession = "none+icewm";
253254
services.xserver.windowManager.icewm.enable = true;

nixos/modules/hardware/video/nvidia.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ in
7575
7676
Note that this configuration will only be successful when a display manager
7777
for which the <option>services.xserver.displayManager.setupCommands</option>
78-
option is supported is used.
78+
option is supported is used; notably, SLiM is not supported.
7979
'';
8080
};
8181

nixos/modules/services/x11/desktop-managers/plasma5.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ in
222222
security.pam.services.kdm.enableKwallet = true;
223223
security.pam.services.lightdm.enableKwallet = true;
224224
security.pam.services.sddm.enableKwallet = true;
225+
security.pam.services.slim.enableKwallet = true;
225226

226227
xdg.portal.enable = true;
227228
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];

nixos/modules/services/x11/display-managers/default.nix

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# This module declares the options to define a *display manager*, the
2-
# program responsible for handling X logins (such as LightDM, GDM, or SDDM).
3-
# The display manager allows the user to select a *session
4-
# type*. When the user logs in, the display manager starts the
2+
# program responsible for handling X logins (such as xdm, gdb, or
3+
# SLiM). The display manager allows the user to select a *session
4+
# type*. When the user logs in, the display manager starts the
55
# *session script* ("xsession" below) to launch the selected session
6-
# type. The session type defines two things: the *desktop manager*
6+
# type. The session type defines two things: the *desktop manager*
77
# (e.g., KDE, Gnome or a plain xterm), and optionally the *window
88
# manager* (e.g. kwin or twm).
99

@@ -308,14 +308,15 @@ in
308308
execCmd = mkOption {
309309
type = types.str;
310310
example = literalExample ''
311-
"''${pkgs.lightdm}/bin/lightdm"
311+
"''${pkgs.slim}/bin/slim"
312312
'';
313313
description = "Command to start the display manager.";
314314
};
315315

316316
environment = mkOption {
317317
type = types.attrsOf types.unspecified;
318318
default = {};
319+
example = { SLIM_CFGFILE = "/etc/slim.conf"; };
319320
description = "Additional environment variables needed by the display manager.";
320321
};
321322

nixos/modules/services/x11/display-managers/slim.nix

Lines changed: 150 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,155 @@
22

33
with lib;
44

5+
let
6+
7+
dmcfg = config.services.xserver.displayManager;
8+
9+
cfg = dmcfg.slim;
10+
11+
slimConfig = pkgs.writeText "slim.cfg"
12+
''
13+
xauth_path ${dmcfg.xauthBin}
14+
default_xserver ${dmcfg.xserverBin}
15+
xserver_arguments ${toString dmcfg.xserverArgs}
16+
sessiondir ${dmcfg.session.desktops}/share/xsessions
17+
login_cmd exec ${pkgs.runtimeShell} ${dmcfg.session.wrapper} "%session"
18+
halt_cmd ${config.systemd.package}/sbin/shutdown -h now
19+
reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
20+
logfile /dev/stderr
21+
${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)}
22+
${optionalString (cfg.defaultUser != null) ("focus_password yes")}
23+
${optionalString cfg.autoLogin "auto_login yes"}
24+
${optionalString (cfg.consoleCmd != null) "console_cmd ${cfg.consoleCmd}"}
25+
${cfg.extraConfig}
26+
'';
27+
28+
# Unpack the SLiM theme, or use the default.
29+
slimThemesDir =
30+
let
31+
unpackedTheme = pkgs.runCommand "slim-theme" { preferLocalBuild = true; }
32+
''
33+
mkdir -p $out
34+
cd $out
35+
unpackFile ${cfg.theme}
36+
ln -s * default
37+
'';
38+
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
39+
40+
in
41+
542
{
6-
# added 2019-11-11
7-
imports = [
8-
(mkRemovedOptionModule [ "services" "xserver" "displayManager" "slim" ] ''
9-
The SLIM project is abandoned and their last release was in 2013.
10-
Because of this it poses a security risk to your system.
11-
Other issues include it not fully supporting systemd and logind sessions.
12-
Please use a different display manager such as LightDM, SDDM, or GDM.
13-
You can also use the startx module which uses Xinitrc.
14-
'')
15-
];
43+
44+
###### interface
45+
46+
options = {
47+
48+
services.xserver.displayManager.slim = {
49+
50+
enable = mkOption {
51+
type = types.bool;
52+
default = false;
53+
description = ''
54+
Whether to enable SLiM as the display manager.
55+
'';
56+
};
57+
58+
theme = mkOption {
59+
type = types.nullOr types.path;
60+
default = pkgs.fetchurl {
61+
url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
62+
sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
63+
};
64+
defaultText = ''pkgs.fetchurl {
65+
url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
66+
sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
67+
}'';
68+
example = literalExample ''
69+
pkgs.fetchurl {
70+
url = "mirror://sourceforge/slim.berlios/slim-wave.tar.gz";
71+
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
72+
}
73+
'';
74+
description = ''
75+
The theme for the SLiM login manager. If not specified, SLiM's
76+
default theme is used. See <link
77+
xlink:href='http://slim.berlios.de/themes01.php'/> for a
78+
collection of themes. TODO: berlios shut down.
79+
'';
80+
};
81+
82+
defaultUser = mkOption {
83+
type = types.nullOr types.str;
84+
default = null;
85+
example = "login";
86+
description = ''
87+
The default user to load. If you put a username here you
88+
get it automatically loaded into the username field, and
89+
the focus is placed on the password.
90+
'';
91+
};
92+
93+
autoLogin = mkOption {
94+
type = types.bool;
95+
default = false;
96+
description = ''
97+
Automatically log in as the default user.
98+
'';
99+
};
100+
101+
extraConfig = mkOption {
102+
type = types.lines;
103+
default = "";
104+
description = ''
105+
Extra configuration options for SLiM login manager. Do not
106+
add options that can be configured directly.
107+
'';
108+
};
109+
110+
consoleCmd = mkOption {
111+
type = types.nullOr types.str;
112+
default = ''
113+
${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ${pkgs.shadow}/bin/login
114+
'';
115+
defaultText = ''
116+
''${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ''${pkgs.shadow}/bin/login
117+
'';
118+
description = ''
119+
The command to run when "console" is given as the username.
120+
'';
121+
};
122+
};
123+
124+
};
125+
126+
127+
###### implementation
128+
129+
config = mkIf cfg.enable {
130+
131+
services.xserver.displayManager.job =
132+
{ environment =
133+
{ SLIM_CFGFILE = slimConfig;
134+
SLIM_THEMESDIR = slimThemesDir;
135+
};
136+
execCmd = "exec ${pkgs.slim}/bin/slim";
137+
};
138+
139+
services.xserver.displayManager.sessionCommands =
140+
''
141+
# Export the config/themes for slimlock.
142+
export SLIM_THEMESDIR=${slimThemesDir}
143+
'';
144+
145+
# Allow null passwords so that the user can login as root on the
146+
# installation CD.
147+
security.pam.services.slim = { allowNullPassword = true; startSession = true; };
148+
149+
# Allow slimlock to work.
150+
security.pam.services.slimlock = {};
151+
152+
environment.systemPackages = [ pkgs.slim ];
153+
154+
};
155+
16156
}

nixos/modules/services/x11/xserver.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ in
558558
let dmconf = cfg.displayManager;
559559
default = !(dmconf.gdm.enable
560560
|| dmconf.sddm.enable
561+
|| dmconf.slim.enable
561562
|| dmconf.xpra.enable );
562563
in mkIf (default) true;
563564

nixos/release-combined.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ in rec {
132132
(all nixos.tests.proxy)
133133
(all nixos.tests.sddm.default)
134134
(all nixos.tests.simple)
135+
(all nixos.tests.slim)
135136
(all nixos.tests.switchTest)
136137
(all nixos.tests.udisks2)
137138
(all nixos.tests.xfce)

nixos/tests/all-tests.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ in
261261
shiori = handleTest ./shiori.nix {};
262262
signal-desktop = handleTest ./signal-desktop.nix {};
263263
simple = handleTest ./simple.nix {};
264+
slim = handleTest ./slim.nix {};
264265
slurm = handleTest ./slurm.nix {};
265266
smokeping = handleTest ./smokeping.nix {};
266267
snapper = handleTest ./snapper.nix {};

nixos/tests/slim.nix

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import ./make-test.nix ({ pkgs, ...} : {
2+
name = "slim";
3+
4+
meta = with pkgs.stdenv.lib.maintainers; {
5+
maintainers = [ aszlig ];
6+
};
7+
8+
machine = { pkgs, ... }: {
9+
imports = [ ./common/user-account.nix ];
10+
services.xserver.enable = true;
11+
services.xserver.windowManager.default = "icewm";
12+
services.xserver.windowManager.icewm.enable = true;
13+
services.xserver.desktopManager.default = "none";
14+
services.xserver.displayManager.slim = {
15+
enable = true;
16+
17+
# Use a custom theme in order to get best OCR results
18+
theme = pkgs.runCommand "slim-theme-ocr" {
19+
nativeBuildInputs = [ pkgs.imagemagick ];
20+
} ''
21+
mkdir "$out"
22+
convert -size 1x1 xc:white "$out/background.jpg"
23+
convert -size 200x100 xc:white "$out/panel.jpg"
24+
cat > "$out/slim.theme" <<EOF
25+
background_color #ffffff
26+
background_style tile
27+
28+
input_fgcolor #000000
29+
msg_color #000000
30+
31+
session_color #000000
32+
session_font Verdana:size=16:bold
33+
34+
username_msg Username:
35+
username_font Verdana:size=16:bold
36+
username_color #000000
37+
username_x 50%
38+
username_y 40%
39+
40+
password_msg Password:
41+
password_x 50%
42+
password_y 40%
43+
EOF
44+
'';
45+
};
46+
};
47+
48+
enableOCR = true;
49+
50+
testScript = { nodes, ... }: let
51+
user = nodes.machine.config.users.users.alice;
52+
in ''
53+
startAll;
54+
$machine->waitForText(qr/Username:/);
55+
$machine->sendChars("${user.name}\n");
56+
$machine->waitForText(qr/Password:/);
57+
$machine->sendChars("${user.password}\n");
58+
59+
$machine->waitForFile('${user.home}/.Xauthority');
60+
$machine->succeed('xauth merge ${user.home}/.Xauthority');
61+
$machine->waitForWindow('^IceWM ');
62+
63+
# Make sure SLiM doesn't create a log file
64+
$machine->fail('test -e /var/log/slim.log');
65+
'';
66+
})

0 commit comments

Comments
 (0)