oizys/modules/desktop/lock/default.nix

34 lines
734 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
...
}: 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";
runtimeInputs = with pkgs; [i3lock-color figlet procps];
text = builtins.readFile ./lock.sh;
};
2024-01-23 11:51:13 -06: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 = {
wantedBy = ["sleep.target"];
description = "Lock the screen using a custom lock script";
before = ["suspend.target"];
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
};
}