blob: 32459783dab7415cd6832203837e37729f40b1aa (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# 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;
# HACK: We search for the generate river desktop file, which should exist <2026-03-13>
riverDesktop =
lib.lists.findFirst
(x: lib.strings.hasSuffix "river.desktop" x)
null
config.home-manager.users.soispha.home.packages;
shellDesktop = pkgs.writeText "zsh.desktop" ''
[Desktop Entry]
Comment=A simple shell session
DesktopNames=null
Exec=zsh
Name=zsh shell
Terminal=true
'';
customSessionsDir =
pkgs.runCommand "custom-sessions" {}
/*
bash
*/
''
mkdir "$out";
cp "${riverDesktop}/share/applications/river.desktop" "$out"
cp "${shellDesktop}" "$out"
'';
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 {
assertions = [
{
assertion = riverDesktop != null;
message = ''
There seems to be no `river.desktop` file generated. You will not be able to
log-into river without it.
'';
}
];
services.displayManager.ly = {
enable = true;
x11Support = false;
settings = {
battery_id = cfg.batteryName;
# Stop animations after 10 secs.
animation_timeout_sec = 60;
animation = "colormix";
custom_sessions = "${customSessionsDir}";
# Clear the screen before starting up (otherwise error messages might linger on
# it.)
start_cmd = "clear";
# 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
};
};
};
}
|