diff options
Diffstat (limited to 'lass/3modules/screenlock.nix')
-rw-r--r-- | lass/3modules/screenlock.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lass/3modules/screenlock.nix b/lass/3modules/screenlock.nix new file mode 100644 index 000000000..06ca1f27d --- /dev/null +++ b/lass/3modules/screenlock.nix @@ -0,0 +1,37 @@ +{ pkgs, config, ... }: + +with import <stockholm/lib>; + +let + cfg = config.lass.screenlock; + + out = { + options.lass.screenlock = api; + config = mkIf cfg.enable imp; + }; + + api = { + enable = mkEnableOption "screenlock"; + command = mkOption { + type = types.str; + default = "${pkgs.i3lock}/bin/i3lock -i /var/lib/wallpaper/wallpaper -f"; + }; + }; + + imp = { + systemd.services.screenlock = { + before = [ "sleep.target" ]; + wantedBy = [ "sleep.target" ]; + environment = { + DISPLAY = ":0"; + }; + serviceConfig = { + SyslogIdentifier = "screenlock"; + ExecStart = cfg.command; + Type = "forking"; + User = "lass"; + }; + }; + }; + +in out |