blob: 7ea4511a3757052ed77b449beb1275edb215dd21 (
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# 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 = ./zsh.desktop;
# TODO: This could use the `services.display-manager.sessionPackages` option <2026-06-23>
customSessionsDir =
pkgs.runCommand "custom-sessions" {}
''
mkdir "$out";
cp "${riverDesktop}/share/applications/river.desktop" "$out"
cp "${shellDesktop}" "$out/zsh.desktop"
'';
setup = pkgs.writeShellApplication {
name = "setup";
bashOptions = [];
runtimeInputs = [
pkgs.findutils
pkgs.systemd
];
inheritPath = true;
text = builtins.readFile ./setup.sh;
};
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.
'';
}
];
home-manager.users.soispha = {
home.sessionVariables = {
XCOMPOSECACHE = "${config.home-manager.users.soispha.xdg.cacheHome}/X11/xcompose";
};
};
services.displayManager.ly = {
enable = true;
x11Support = false;
settings = {
battery_id = cfg.batteryName;
# Stop animations after 10 secs.
animation_timeout_sec = 60;
animation = "dur_file";
dur_file_path = "${./blackhole-smooth-240x67.dur}";
full_color = true;
# NOTE: This does the same as the default nixos setup cmd, but we don't
# immidiately start the `graphical-session.target`. That is started by river's
# init. <2026-06-23>
setup_cmd = "${lib.getExe setup}";
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;
session_log = "${config.home-manager.users.soispha.xdg.dataHome}/ly/ly-session.log";
clock = "%c";
hibernate_cmd = "systemctl hibernate";
inactivity_cmd = "systemctl suspend-then-hibernate";
restart_cmd = "reboot";
shutdown_cmd = "shutdown $PLATFORM_SHUTDOWN_ARG now";
sleep_cmd = "systemctl suspend";
inactivity_delay = 120; # unit is seconds
};
};
};
}
|