about summary refs log tree commit diff stats
path: root/modules/by-name/ly
diff options
context:
space:
mode:
Diffstat (limited to 'modules/by-name/ly')
-rw-r--r--modules/by-name/ly/ly/blackhole-smooth-240x67.durbin0 -> 484298 bytes
-rw-r--r--modules/by-name/ly/ly/module.nix110
2 files changed, 110 insertions, 0 deletions
diff --git a/modules/by-name/ly/ly/blackhole-smooth-240x67.dur b/modules/by-name/ly/ly/blackhole-smooth-240x67.dur
new file mode 100644
index 00000000..d65c878f
--- /dev/null
+++ b/modules/by-name/ly/ly/blackhole-smooth-240x67.dur
Binary files differdiff --git a/modules/by-name/ly/ly/module.nix b/modules/by-name/ly/ly/module.nix
new file mode 100644
index 00000000..dedabe81
--- /dev/null
+++ b/modules/by-name/ly/ly/module.nix
@@ -0,0 +1,110 @@
+# 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.
+        '';
+      }
+    ];
+
+    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;
+
+        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 = "systmectl suspend-then-hibernate";
+        restart_cmd = "reboot";
+        shutdown_cmd = "shutdown $PLATFORM_SHUTDOWN_ARG now";
+        sleep_cmd = "systemctl suspend";
+
+        inactivity_delay = 30; # unit is seconds
+      };
+    };
+  };
+}