betterlockscreen: add module (#2292)

This commit is contained in:
Basti 2021-09-06 03:00:28 +02:00 committed by GitHub
parent 2952168ed5
commit 5e46262cb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 0 deletions

2
.github/CODEOWNERS vendored
View file

@ -214,6 +214,8 @@
/modules/services/barrier.nix @Kritnich /modules/services/barrier.nix @Kritnich
/tests/modules/services/barrier @Kritnich /tests/modules/services/barrier @Kritnich
/modules/services/betterlockscreen.nix @SebTM
/modules/services/caffeine.nix @uvNikita /modules/services/caffeine.nix @uvNikita
/modules/services/cbatticon.nix @pmiddend /modules/services/cbatticon.nix @pmiddend

View file

@ -2188,6 +2188,14 @@ in
A new module is available: 'services.fnott'. 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'.
'';
}
]; ];
}; };
} }

View file

@ -148,6 +148,7 @@ let
./programs/zsh.nix ./programs/zsh.nix
./programs/zsh/prezto.nix ./programs/zsh/prezto.nix
./services/barrier.nix ./services/barrier.nix
./services/betterlockscreen.nix
./services/blueman-applet.nix ./services/blueman-applet.nix
./services/caffeine.nix ./services/caffeine.nix
./services/cbatticon.nix ./services/cbatticon.nix

View file

@ -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 <command>betterlockscreen</command>.";
};
arguments = mkOption {
type = types.listOf types.str;
default = [ ];
description =
"List of arguments appended to <literal>./betterlockscreen --lock [args]</literal>";
};
inactiveInterval = mkOption {
type = types.int;
default = 10;
description = ''
Value used for <option>services.screen-locker.inactiveInterval</option>.
'';
};
};
};
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
}";
};
};
}