about summary refs log tree commit diff stats
path: root/modules/by-name/ly/ly/module.nix
blob: 376f6e61de20a10c2af29ecaa66ae6d0f325ccbb (plain) (blame)
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
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg = config.soispha.programs.ly;
in {
  options.soispha.programs.ly = {
    enable = lib.mkEnableOption "ly";

    batteryName = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      example = "BAT0";
      default = null;
      description = "The name of the battery, if null, will not show a batter percentage.";
    };
  };

  config = lib.mkIf cfg.enable {
    services.displayManager.ly = {
      enable = true;
      x11Support = false;

      settings = {
        battery_id = cfg.batteryName;

        # Stop animations after 10 secs.
        animation_timeout_sec = 60;

        animation = "gameoflife";

        # Clear the password on failure.
        clear_password = true;

        clock = "%c";

        hibernate_cmd = "systemctl hibernate";
        inactivity_cmd = "systmectl suspend-then-hibernate";
        restart_cmd = "reboot";
        shutdown_cmd = "shutdown $PLATFORM_SHUTDOWN_ARG now";
        sleep_cmd = "systemctl suspend";

        inactivity_delay = 30; # unit is seconds
      };
    };
  };
}