From 641a62305305692c294ab3f67c597bc90067a667 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 18 May 2018 18:24:53 +0200 Subject: 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"; } ``` --- nixos/modules/programs/xss-lock.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nixos/modules/programs/xss-lock.nix (limited to 'nixos/modules/programs') diff --git a/nixos/modules/programs/xss-lock.nix b/nixos/modules/programs/xss-lock.nix new file mode 100644 index 000000000000..49d522c604f5 --- /dev/null +++ b/nixos/modules/programs/xss-lock.nix @@ -0,0 +1,26 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.programs.xss-lock; +in +{ + options.programs.xss-lock = { + enable = mkEnableOption "xss-lock"; + lockerCommand = mkOption { + example = "xlock"; + type = types.string; + description = "Locker to be used with xsslock"; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.xss-lock = { + description = "XSS Lock Daemon"; + wantedBy = [ "graphical-session.target" ]; + partOf = [ "graphical-session.target" ]; + serviceConfig.ExecStart = "${pkgs.xss-lock}/bin/xss-lock ${cfg.lockerCommand}"; + }; + }; +} -- cgit 1.4.1