oizys/modules/desktop/lock/default.nix

40 lines
762 B
Nix
Raw Normal View History

2024-01-23 11:51:13 -06:00
{
pkgs,
2024-01-28 13:25:23 -06:00
config,
lib,
2024-01-23 11:51:13 -06:00
...
2024-05-06 14:32:00 -05:00
}:
let
2024-01-28 13:25:23 -06:00
inherit (lib) mkIf;
cfg = config.services.xserver.windowManager.qtile;
2024-01-23 11:51:13 -06:00
lock = pkgs.writeShellApplication {
2024-01-28 17:39:10 -06:00
name = "lock";
2024-05-06 14:32:00 -05:00
runtimeInputs = with pkgs; [
i3lock-color
figlet
procps
];
2024-01-28 17:39:10 -06:00
text = builtins.readFile ./lock.sh;
};
2024-05-06 14:32:00 -05:00
in
{
2024-01-28 13:25:23 -06:00
config = mkIf cfg.enable {
2024-01-28 17:39:10 -06:00
environment.systemPackages = with pkgs; [
xss-lock
lock
];
2024-01-23 11:51:13 -06:00
2024-01-28 17:39:10 -06:00
systemd.services.i3lock = {
2024-05-06 14:32:00 -05:00
wantedBy = [ "sleep.target" ];
2024-01-28 17:39:10 -06:00
description = "Lock the screen using a custom lock script";
2024-05-06 14:32:00 -05:00
before = [ "suspend.target" ];
2024-01-28 17:39:10 -06:00
serviceConfig = {
User = "daylin";
Type = "forking";
Environment = "DISPLAY=:0";
ExecStart = "${lock}/bin/lock";
2024-01-28 13:25:23 -06:00
};
2024-01-23 11:51:13 -06:00
};
2024-01-28 17:39:10 -06:00
};
}