nixos/gtklock: init

This commit is contained in:
Fugi 2025-02-19 17:58:52 +01:00
parent 949fb7f308
commit 65a759f7b4
No known key found for this signature in database
GPG key ID: 4472A20091BFA792
3 changed files with 80 additions and 1 deletions

View file

@ -10,7 +10,7 @@
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
- Create the first release note entry in this section!
- [gtklock](https://github.com/jovanlanik/gtklock), a GTK-based lockscreen for Wayland. Available as [programs.gtklock](#opt-programs.gtklock.enable).
## Backward Incompatibilities {#sec-release-25.11-incompatibilities}

View file

@ -331,6 +331,7 @@
./programs/vivid.nix
./programs/wavemon.nix
./programs/wayland/cardboard.nix
./programs/wayland/gtklock.nix
./programs/wayland/hyprland.nix
./programs/wayland/hyprlock.nix
./programs/wayland/labwc.nix

View file

@ -0,0 +1,78 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.gtklock;
configFormat = pkgs.formats.ini {
listToValue = builtins.concatStringsSep ";";
};
inherit (lib)
types
mkOption
mkEnableOption
mkPackageOption
;
in
{
options.programs.gtklock = {
enable = mkEnableOption "gtklock, a GTK-based lockscreen for Wayland";
package = mkPackageOption pkgs "gtklock" { };
config = mkOption {
type = configFormat.type;
example = lib.literalExpression ''
{
main = {
idle-hide = true;
idle-timeout = 10;
};
}'';
description = ''
Configuration for gtklock.
See [`gtklock(1)`](https://github.com/jovanlanik/gtklock/blob/master/man/gtklock.1.scd) man page for details.
'';
};
style = mkOption {
type = with types; nullOr str;
default = null;
description = ''
CSS Stylesheet for gtklock.
See [gtklock's wiki](https://github.com/jovanlanik/gtklock/wiki#Styling) for details.
'';
};
modules = mkOption {
type = with types; listOf package;
default = [ ];
example = lib.literalExpression ''
with pkgs; [
gtklock-playerctl-module
gtklock-powerbar-module
gtklock-userinfo-module
]'';
description = "gtklock modules to load.";
};
};
config = lib.mkIf cfg.enable {
programs.gtklock.config.main = {
style = lib.mkIf (cfg.style != null) "${pkgs.writeText "style.css" cfg.style}";
modules = lib.mkIf (cfg.modules != [ ]) (
map (pkg: "${pkg}/lib/gtklock/${lib.removePrefix "gtklock-" pkg.pname}.so") cfg.modules
);
};
environment.etc."xdg/gtklock/config.ini".source = configFormat.generate "config.ini" cfg.config;
environment.systemPackages = [ cfg.package ];
security.pam.services.gtklock = { };
};
}