1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 20:43:34 +02:00
home-manager/modules/programs/swaylock.nix
2022-06-07 21:01:14 +02:00

33 lines
883 B
Nix

{ config, lib, ... }:
let cfg = config.programs.swaylock;
in {
meta.maintainers = [ lib.hm.maintainers.rcerc ];
options.programs.swaylock.settings = lib.mkOption {
type = with lib.types; attrsOf (oneOf [ bool float int str ]);
default = { };
description = ''
Default arguments to <command>swaylock</command>. An empty set
disables configuration generation.
'';
example = {
color = "808080";
font-size = 24;
indicator-idle-visible = false;
indicator-radius = 100;
line-color = "ffffff";
show-failed-attempts = true;
};
};
config.xdg.configFile."swaylock/config" = lib.mkIf (cfg.settings != { }) {
text = lib.concatStrings (lib.mapAttrsToList (n: v:
if v == false then
""
else
(if v == true then n else n + "=" + builtins.toString v) + "\n")
cfg.settings);
};
}