mirror of
https://github.com/javalsai/lidm.git
synced 2025-08-30 18:08:00 +02:00
feat: make a complete nix module
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, ...}: pkgs.stdenv.mkDerivation rec {
|
{ config, pkgs, lib, ...}: pkgs.stdenv.mkDerivation rec {
|
||||||
pname = "lidm";
|
pname = "lidm";
|
||||||
version = config.version;
|
version = config.version;
|
||||||
src = config.src;
|
src = config.src;
|
||||||
@@ -12,13 +12,11 @@
|
|||||||
makeFlags = [
|
makeFlags = [
|
||||||
"DESTDIR=$(out)"
|
"DESTDIR=$(out)"
|
||||||
"PREFIX="
|
"PREFIX="
|
||||||
];
|
]
|
||||||
|
++ lib.optional (config.xsessions != null)
|
||||||
installPhase = ''
|
"CPPFLAGS+=-DSESSIONS_XSESSIONS=\\\"${config.xsessions}\\\""
|
||||||
make install DESTDIR=$out PREFIX=
|
++ lib.optional (config.wayland-sessions != null)
|
||||||
mkdir -p $out/etc/systemd/system/
|
"CPPFLAGS+=-DSESSIONS_WAYLAND=\\\"${config.wayland-sessions}\\\"";
|
||||||
make install-service-systemd DESTDIR=$out PREFIX=
|
|
||||||
'';
|
|
||||||
|
|
||||||
fixupPhase = ''
|
fixupPhase = ''
|
||||||
rm -rf $out/etc
|
rm -rf $out/etc
|
||||||
|
47
assets/pkg/nix/module.nix
Normal file
47
assets/pkg/nix/module.nix
Normal 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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@@ -5,9 +5,9 @@ After=systemd-user-sessions.service plymouth-quit-wait.service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=idle
|
Type=idle
|
||||||
ExecStart=/usr/bin/lidm 7
|
ExecStart=/usr/bin/lidm 7
|
||||||
StandardError=journal
|
|
||||||
StandardInput=tty
|
StandardInput=tty
|
||||||
StandardOutput=tty
|
StandardOutput=tty
|
||||||
|
StandardError=tty
|
||||||
TTYPath=/dev/tty7
|
TTYPath=/dev/tty7
|
||||||
TTYReset=yes
|
TTYReset=yes
|
||||||
TTYVHangup=yes
|
TTYVHangup=yes
|
||||||
|
12
flake.nix
12
flake.nix
@@ -20,7 +20,13 @@
|
|||||||
|
|
||||||
lidm = pkgs.callPackage assets/pkg/nix/lidm.nix {
|
lidm = pkgs.callPackage assets/pkg/nix/lidm.nix {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
config = { inherit version; src = ./.; };
|
lib = pkgs.lib;
|
||||||
|
config = {
|
||||||
|
inherit version;
|
||||||
|
src = ./.;
|
||||||
|
xsessions = null;
|
||||||
|
wayland-sessions = null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
@@ -28,5 +34,7 @@
|
|||||||
defaultPackage = lidm;
|
defaultPackage = lidm;
|
||||||
devShell = pkgs.mkShell { buildInputs = lidm.nativeBuildInputs ++ [ pkgs.clang-tools ]; };
|
devShell = pkgs.mkShell { buildInputs = lidm.nativeBuildInputs ++ [ pkgs.clang-tools ]; };
|
||||||
}
|
}
|
||||||
);
|
) // {
|
||||||
|
nixosModules.lidm = assets/pkg/nix/module.nix;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user