lol

nixos/xss-lock: add module (#40619)

`xsslock` (which was originally packaged in 6cb1d1aaaf02a72329bedf9c6960e54fea6f5c6e)
is a simple screensaver which connects a given screen locker (e.g.
`i3lock`) with `logind`. Whenever `loginctl lock-sessions` is invoked
the locker will be used to lock the screen. This works with its power
management features (e.g. `lid switch`) as well, so the PC can be locked
automatically when the lid is closed.

The module can be used like this:

```
{
services.xserver.enable = true;

programs.xss-lock.enable = true;
programs.xss-lock.lockerCommand = "i3lock";
}
```

authored by

Maximilian Bosch and committed by
xeji
641a6230 cfc016c7

+53
+1
nixos/modules/module-list.nix
··· 122 122 ./programs/wireshark.nix 123 123 ./programs/xfs_quota.nix 124 124 ./programs/xonsh.nix 125 + ./programs/xss-lock.nix 125 126 ./programs/yabar.nix 126 127 ./programs/zsh/oh-my-zsh.nix 127 128 ./programs/zsh/zsh.nix
+26
nixos/modules/programs/xss-lock.nix
··· 1 + { config, pkgs, lib, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.programs.xss-lock; 7 + in 8 + { 9 + options.programs.xss-lock = { 10 + enable = mkEnableOption "xss-lock"; 11 + lockerCommand = mkOption { 12 + example = "xlock"; 13 + type = types.string; 14 + description = "Locker to be used with xsslock"; 15 + }; 16 + }; 17 + 18 + config = mkIf cfg.enable { 19 + systemd.user.services.xss-lock = { 20 + description = "XSS Lock Daemon"; 21 + wantedBy = [ "graphical-session.target" ]; 22 + partOf = [ "graphical-session.target" ]; 23 + serviceConfig.ExecStart = "${pkgs.xss-lock}/bin/xss-lock ${cfg.lockerCommand}"; 24 + }; 25 + }; 26 + }
+1
nixos/release.nix
··· 402 402 tests.xfce = callTest tests/xfce.nix {}; 403 403 tests.xmonad = callTest tests/xmonad.nix {}; 404 404 tests.xrdp = callTest tests/xrdp.nix {}; 405 + tests.xss-lock = callTest tests/xss-lock.nix {}; 405 406 tests.yabar = callTest tests/yabar.nix {}; 406 407 tests.zookeeper = callTest tests/zookeeper.nix {}; 407 408
+25
nixos/tests/xss-lock.nix
··· 1 + import ./make-test.nix ({ pkgs, lib, ... }: 2 + 3 + with lib; 4 + 5 + { 6 + name = "xss-lock"; 7 + meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ma27 ]; 8 + 9 + machine = { 10 + imports = [ ./common/x11.nix ./common/user-account.nix ]; 11 + programs.xss-lock.enable = true; 12 + programs.xss-lock.lockerCommand = "${pkgs.xlockmore}/bin/xlock"; 13 + services.xserver.displayManager.auto.user = "alice"; 14 + }; 15 + 16 + testScript = '' 17 + $machine->start; 18 + $machine->waitForX; 19 + $machine->waitForUnit("xss-lock.service", "alice"); 20 + 21 + $machine->fail("pgrep xlock"); 22 + $machine->succeed("su -l alice -c 'xset dpms force standby'"); 23 + $machine->succeed("pgrep xlock"); 24 + ''; 25 + })