From 5e46262cb1fa888f6f46a675cc2806a23ba9625c Mon Sep 17 00:00:00 2001 From: Basti Date: Mon, 6 Sep 2021 03:00:28 +0200 Subject: [PATCH] betterlockscreen: add module (#2292) --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++ modules/modules.nix | 1 + modules/services/betterlockscreen.nix | 50 +++++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 modules/services/betterlockscreen.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2720c7eb2..7326fb670 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -214,6 +214,8 @@ /modules/services/barrier.nix @Kritnich /tests/modules/services/barrier @Kritnich +/modules/services/betterlockscreen.nix @SebTM + /modules/services/caffeine.nix @uvNikita /modules/services/cbatticon.nix @pmiddend diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 69a187698..4807fcb79 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -2188,6 +2188,14 @@ in A new module is available: 'services.fnott'. ''; } + + { + time = "2021-08-31T18:44:26+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.betterlockscreen'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index db6bdb295..a1a4c5f6e 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -148,6 +148,7 @@ let ./programs/zsh.nix ./programs/zsh/prezto.nix ./services/barrier.nix + ./services/betterlockscreen.nix ./services/blueman-applet.nix ./services/caffeine.nix ./services/cbatticon.nix diff --git a/modules/services/betterlockscreen.nix b/modules/services/betterlockscreen.nix new file mode 100644 index 000000000..970f07728 --- /dev/null +++ b/modules/services/betterlockscreen.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.services.betterlockscreen; + +in { + meta.maintainers = with maintainers; [ sebtm ]; + + options = { + services.betterlockscreen = { + enable = mkEnableOption "betterlockscreen, a screen-locker module"; + + package = mkOption { + type = types.package; + default = pkgs.betterlockscreen; + defaultText = literalExample "pkgs.betterlockscreen"; + description = "Package providing betterlockscreen."; + }; + + arguments = mkOption { + type = types.listOf types.str; + default = [ ]; + description = + "List of arguments appended to ./betterlockscreen --lock [args]"; + }; + + inactiveInterval = mkOption { + type = types.int; + default = 10; + description = '' + Value used for . + ''; + }; + + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + services.screen-locker = { + enable = true; + inactiveInterval = cfg.inactiveInterval; + lockCmd = "${cfg.package}/bin/betterlockscreen --lock ${ + concatStringsSep " " cfg.arguments + }"; + }; + }; +}