feat: make a complete nix module

This commit is contained in:
2025-07-06 05:06:54 +02:00
parent 6cac2f91ed
commit be6e039a9b
4 changed files with 64 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
{ config, pkgs, ...}: pkgs.stdenv.mkDerivation rec {
{ config, pkgs, lib, ...}: pkgs.stdenv.mkDerivation rec {
pname = "lidm";
version = config.version;
src = config.src;
@@ -12,13 +12,11 @@
makeFlags = [
"DESTDIR=$(out)"
"PREFIX="
];
installPhase = ''
make install DESTDIR=$out PREFIX=
mkdir -p $out/etc/systemd/system/
make install-service-systemd DESTDIR=$out PREFIX=
'';
]
++ lib.optional (config.xsessions != null)
"CPPFLAGS+=-DSESSIONS_XSESSIONS=\\\"${config.xsessions}\\\""
++ lib.optional (config.wayland-sessions != null)
"CPPFLAGS+=-DSESSIONS_WAYLAND=\\\"${config.wayland-sessions}\\\"";
fixupPhase = ''
rm -rf $out/etc

47
assets/pkg/nix/module.nix Normal file
View File

@@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
let
dmcfg = config.services.displayManager;
desktops = dmcfg.sessionData.desktops;
version = "1.2.1";
lidmPkg = pkgs.callPackage ./lidm.nix {
inherit pkgs;
config = {
inherit version lib;
src = pkgs.fetchFromGitHub {
owner = "javalsai";
repo = "lidm";
rev = "v${version}";
sha256 = "sha256-3CgUI8PUs4c1bfBrykPw87SSa4lzrh4E4Hug7cGRKFk=";
};
xsessions = "${desktops}/share/xsessions";
wayland-sessions = "${desktops}/share/wayland-sessions";
};
};
in
{
config = {
services.displayManager.defaultSession = "lidm";
systemd.services.lidm = {
description = "TUI display manager";
aliases = [ "display-manager.service" ];
after = [
"systemd-user-sessions.service"
"plymouth-quit-wait.service"
];
serviceConfig = {
Type = "idle";
ExecStart = "${lidmPkg}/bin/lidm 7";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "tty";
TTYPath = "/dev/tty7";
TTYReset = "yes";
TTYVHangup = "yes";
};
};
};
}

View File

@@ -5,9 +5,9 @@ After=systemd-user-sessions.service plymouth-quit-wait.service
[Service]
Type=idle
ExecStart=/usr/bin/lidm 7
StandardError=journal
StandardInput=tty
StandardOutput=tty
StandardError=tty
TTYPath=/dev/tty7
TTYReset=yes
TTYVHangup=yes