forked from Lexonight1/thermalright-trcc-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
111 lines (92 loc) · 3.27 KB
/
flake.nix
File metadata and controls
111 lines (92 loc) · 3.27 KB
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
{
description = "TRCC Linux — Thermalright LCD/LED Control Center";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
python = pkgs.python312;
in {
packages.default = python.pkgs.buildPythonApplication {
pname = "trcc-linux";
version = "8.0.1";
pyproject = true;
src = ./.;
build-system = [ python.pkgs.hatchling ];
dependencies = with python.pkgs; [
pyside6
pillow
numpy
psutil
pyusb
click
typer
fastapi
uvicorn
];
optional-dependencies = {
nvidia = [ python.pkgs.pynvml ];
};
nativeBuildInputs = [ pkgs.makeWrapper ];
# Skip tests during build (they need USB devices)
doCheck = false;
postInstall = ''
# udev rules
install -Dm644 packaging/udev/99-trcc-lcd.rules \
$out/lib/udev/rules.d/99-trcc-lcd.rules
# modprobe config
install -Dm644 packaging/modprobe/trcc-lcd.conf \
$out/etc/modprobe.d/trcc-lcd.conf
# modules-load
install -Dm644 packaging/modprobe/trcc-sg.conf \
$out/etc/modules-load.d/trcc-sg.conf
# desktop entry
install -Dm644 src/trcc/assets/trcc-linux.desktop \
$out/share/applications/trcc-linux.desktop
# polkit policy
install -Dm644 src/trcc/assets/com.github.lexonight1.trcc.policy \
$out/share/polkit-1/actions/com.github.lexonight1.trcc.policy
'';
meta = with pkgs.lib; {
description = "Thermalright LCD/LED Control Center for Linux";
homepage = "https://github.com/Lexonight1/thermalright-trcc-linux";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = [ ];
};
};
# Dev shell for contributors
devShells.default = pkgs.mkShell {
packages = [
(python.withPackages (ps: with ps; [
pyside6 pillow numpy psutil pyusb click typer fastapi uvicorn
pytest pytest-cov ruff
]))
pkgs.p7zip
pkgs.sg3_utils
];
};
}
) // {
# NixOS module for system-level integration
nixosModules.default = { config, lib, pkgs, ... }:
let
cfg = config.programs.trcc-linux;
in {
options.programs.trcc-linux = {
enable = lib.mkEnableOption "TRCC Linux — Thermalright LCD/LED Control Center";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ self.packages.${pkgs.system}.default ];
services.udev.extraRules = builtins.readFile ./packaging/udev/99-trcc-lcd.rules;
boot.kernelModules = [ "sg" ];
boot.extraModprobeConfig = ''
options usb-storage quirks=0402:3922:u,0416:5406:u,87cd:70db:u
'';
};
};
};
}