-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdefault.nix
More file actions
79 lines (66 loc) · 2.81 KB
/
default.nix
File metadata and controls
79 lines (66 loc) · 2.81 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
{ lib
, python3
, fetchFromGitHub
, makeWrapper
}:
python3.pkgs.buildPythonApplication rec {
pname = "led-matrix-monitoring";
version = "1.2.0-yaml";
format = "other";
src = ./.;
nativeBuildInputs = [
makeWrapper
python3.pkgs.setuptools
python3.pkgs.wheel
];
propagatedBuildInputs = with python3.pkgs; [
pyserial
numpy
psutil
evdev
pynput
pyyaml # Required for YAML config parsing
python-dotenv # Required for environment variable loading
requests # Required for time_weather_plugin
scipy # Required for equalizer plugin
sounddevice # Required for equalizer plugin
pulsectl # Required for equalizer plugin
# Note: iplocate is not available in nixpkgs - time_weather_plugin will need to handle this gracefully
];
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/lib/python${python3.pythonVersion}/site-packages
mkdir -p $out/share/led-matrix
# Copy the entire led_mon module
cp -r led_mon $out/lib/python${python3.pythonVersion}/site-packages/
# Note: time_weather_plugin is included - iplocate import is lazy-loaded inside a function,
# so the plugin will work for zip/lat-lon lookups even without iplocate package.
# IP-based location lookup will fail gracefully if iplocate is not available.
# Copy main.py to the package root
cp main.py $out/lib/python${python3.pythonVersion}/site-packages/
# Copy example config and .env to share for reference
cp led_mon/config.yaml $out/share/led-matrix/config.example.yaml
cp .env-example $out/share/led-matrix/.env-example
# Create wrapper script with proper Python environment
makeWrapper ${python3.withPackages (ps: with ps; [ pyserial numpy psutil evdev pynput pyyaml python-dotenv requests scipy sounddevice pulsectl ])}/bin/python $out/bin/led-matrix-monitor \
--add-flags "$out/lib/python${python3.pythonVersion}/site-packages/main.py" \
--prefix PYTHONPATH : "$out/lib/python${python3.pythonVersion}/site-packages"
'';
# Skip tests for now since there aren't any
doCheck = false;
meta = with lib; {
description = "System monitoring application for Framework 16 LED Matrix Panels";
longDescription = ''
This software displays system performance characteristics in real-time
on Framework 16 laptop LED Matrix Panels, including CPU utilization,
battery status, memory usage, disk I/O, network traffic, temperatures,
and fan speeds. Includes robustness improvements for permission handling
and graceful degradation when hardware is not available.
'';
homepage = "https://code.karsttech.com/jeremy/FW_LED_System_Monitor.git";
license = licenses.mit; # Assuming MIT, adjust if different
maintainers = [ ];
platforms = platforms.linux;
mainProgram = "led-matrix-monitor";
};
}