1 { config, lib, pkgs, ... }:
5 cfg = config.programs.i3lock;
13 enable = lib.mkEnableOption "i3lock";
14 package = lib.mkPackageOption pkgs "i3lock" {
15 example = "i3lock-color";
18 The i3lock package must include a i3lock file or link in its out directory in order for the u2fSupport option to work correctly.
22 u2fSupport = lib.mkOption {
23 type = lib.types.bool;
27 Whether to enable U2F support in the i3lock program.
28 U2F enables authentication using a hardware device, such as a security key.
29 When U2F support is enabled, the i3lock program will set the setuid bit on the i3lock binary and enable the pam u2fAuth service,
37 config = lib.mkIf cfg.enable {
39 environment.systemPackages = [ cfg.package ];
41 security.wrappers.i3lock = lib.mkIf cfg.u2fSupport {
45 source = "${cfg.package.out}/bin/i3lock";
48 security.pam.services.i3lock.u2fAuth = cfg.u2fSupport;