1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
resources,
config,
lib,
pkgs,
...
}:
let
cfg = config.zpha.programs.swaylock;
in
{
options.zpha.programs.swaylock = {
enable = lib.mkEnableOption "swaylock";
settings = lib.mkOption {
default = { };
type =
with lib.types;
attrsOf (oneOf [
bool
float
int
path
str
]);
};
};
config = lib.mkIf cfg.enable {
zpha.programs.swaylock.settings = {
# clock = true;
indicator = true;
ring-color = "4aa96c";
show-failed-attempts = true;
fingerprint = false;
command = "${lib.getExe pkgs.zpha.shaderbg} '*' --fps 10 ${resources.shaders.background1}";
# image = "/home/zaphyra/Pictures/Backgrounds/lock.png";
# scaling = "fit";
# color = "ffffaf";
};
security.pam.services.swaylock = { };
security.pam.services.swaylock-plugin = { };
services.systemd-lock-handler.enable = true;
users.users.zaphyra.maid = {
packages = [ pkgs.pkgs.swaylock-plugin-fprintd ];
file.xdg_config = {
"swaylock/config".text = lib.concatStrings (
lib.flip lib.mapAttrsToList cfg.settings (
n: v:
if v == false then
""
else
(if v == true then n else n + "=" + (if builtins.isPath v then "${v}" else toString v)) + "\n"
)
);
};
systemd.services.swaylock = {
wantedBy = [ "lock.target" ];
partOf = [ "lock.target" ];
after = [ "lock.target" ];
environment = lib.mkForce { };
unitConfig.OnSuccess = [ "unlock.target" ];
serviceConfig = {
ExecStart = lib.getExe pkgs.swaylock-plugin-fprintd;
Restart = "on-failure";
RestartSec = 0;
};
};
};
};
}