nixpkgs/nixos/tests/xss-lock.nix
Maximilian Bosch 641a623053 nixos/xss-lock: add module (#40619)
`xsslock` (which was originally packaged in 6cb1d1aaaf)
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";
}
```
2018-05-18 18:24:53 +02:00

25 lines
659 B
Nix

import ./make-test.nix ({ pkgs, lib, ... }:
with lib;
{
name = "xss-lock";
meta.maintainers = with pkgs.stdenv.lib.maintainers; [ ma27 ];
machine = {
imports = [ ./common/x11.nix ./common/user-account.nix ];
programs.xss-lock.enable = true;
programs.xss-lock.lockerCommand = "${pkgs.xlockmore}/bin/xlock";
services.xserver.displayManager.auto.user = "alice";
};
testScript = ''
$machine->start;
$machine->waitForX;
$machine->waitForUnit("xss-lock.service", "alice");
$machine->fail("pgrep xlock");
$machine->succeed("su -l alice -c 'xset dpms force standby'");
$machine->succeed("pgrep xlock");
'';
})