nixos/ddccontrol: enable hardware.i2c and mention its group (#457031)

This commit is contained in:
Doron Behar
2025-11-10 06:15:55 +00:00
committed by GitHub
6 changed files with 171 additions and 20 deletions
+2
View File
@@ -96,6 +96,8 @@
- `spidermonkey_91` has been removed, as it has been EOL since September 2022.
- `ddccontrol` service now enables `hardware.i2c` by default, and adds `ddcci_backlight` to the kernel modules, based on [experiences reported on discourse](https://discourse.nixos.org/t/brightness-control-of-external-monitors-with-ddcci-backlight/8639/).
- The license of duckstation has changed from `gpl3Only` to `cc-by-nc-nd-40` making it unfree in newer releases. The `duckstation` package has been overhauled to support the new releases and `duckstation-bin` has been aliased to `duckstation` to support darwin binary builds.
- `hiawata` has been removed, due to lack of active development upstream, lack of maintainership downstream and upcoming security issues.
+24 -6
View File
@@ -10,31 +10,49 @@ let
in
{
meta.maintainers = with lib.maintainers; [ doronbehar ];
###### interface
options = {
services.ddccontrol = {
enable = lib.mkEnableOption "ddccontrol for controlling displays";
enable = lib.mkEnableOption ''
ddccontrol for controlling displays.
This [enables `hardware.i2c`](#opt-hardware.i2c.enable), so note to add
yourself to [`hardware.i2c.group`](#opt-hardware.i2c.group).
'';
package =
lib.mkPackageOption pkgs
"package with which to control brightness; added also to [services.dbus.packages](#opt-services.dbus.packages)."
{
default = [ "ddccontrol" ];
example = [ "ddcutil-service" ];
};
};
};
###### implementation
config = lib.mkIf cfg.enable {
boot.kernelModules = [
"ddcci_backlight"
];
# Load the i2c-dev module
boot.kernelModules = [ "i2c_dev" ];
hardware.i2c = {
enable = true;
};
# Give users access to the "gddccontrol" tool
environment.systemPackages = [
pkgs.ddccontrol
cfg.package
];
services.dbus.packages = [
pkgs.ddccontrol
cfg.package
];
systemd.packages = [
pkgs.ddccontrol
cfg.package
];
};
}
+10 -7
View File
@@ -8,14 +8,14 @@
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "ddccontrol-db";
version = "20251102";
src = fetchFromGitHub {
owner = "ddccontrol";
repo = "ddccontrol-db";
rev = version;
tag = finalAttrs.version;
sha256 = "sha256-r87zucuHnWbvaqg++xI3s3Tghz80auQBgUxJzu7nmqU=";
};
@@ -30,11 +30,14 @@ stdenv.mkDerivation rec {
./autogen.sh
'';
meta = with lib; {
meta = {
description = "Monitor database for DDCcontrol";
homepage = "https://github.com/ddccontrol/ddccontrol-db";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = [ lib.maintainers.pakhfn ];
license = lib.licenses.gpl2;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
pakhfn
doronbehar
];
};
}
})
+10 -7
View File
@@ -11,14 +11,14 @@
ddccontrol-db,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "ddccontrol";
version = "1.0.3";
src = fetchFromGitHub {
owner = "ddccontrol";
repo = "ddccontrol";
rev = version;
tag = finalAttrs.version;
sha256 = "sha256-qyD6i44yH3EufIW+LA/LBMW20Tejb49zvsDfv6YFD6c=";
};
@@ -53,11 +53,14 @@ stdenv.mkDerivation rec {
intltoolize --force
'';
meta = with lib; {
meta = {
description = "Program used to control monitor parameters by software";
homepage = "https://github.com/ddccontrol/ddccontrol";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with lib.maintainers; [ pakhfn ];
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [
pakhfn
doronbehar
];
};
}
})
@@ -0,0 +1,46 @@
{
lib,
stdenv,
fetchFromGitHub,
# nativeBuildInputs
pkg-config,
# buildInputs
glib,
ddcutil,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ddcutil-service";
version = "1.0.14";
src = fetchFromGitHub {
owner = "digitaltrails";
repo = "ddcutil-service";
rev = "v${finalAttrs.version}";
hash = "sha256-IZ6s9z0zxMZT7qd+yuQJGLnKc1WISIvhJlIGsM/Dw3w=";
};
nativeBuildInputs = [
pkg-config
];
buildInputs = [
glib
ddcutil
];
makeFlags = [
"PREFIX=${placeholder "out"}"
];
meta = {
description = "A Dbus ddcutil server for control of DDC Monitors/VDUs";
homepage = "https://github.com/digitaltrails/ddcutil-service";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ doronbehar ];
mainProgram = "ddcutil-service";
platforms = lib.platforms.linux;
};
})
+79
View File
@@ -0,0 +1,79 @@
{
lib,
python3,
fetchFromGitHub,
fetchpatch,
qt6,
copyDesktopItems,
installShellFiles,
}:
python3.pkgs.buildPythonApplication rec {
pname = "vdu_controls";
version = "2.4.3";
pyproject = true;
src = fetchFromGitHub {
owner = "digitaltrails";
repo = "vdu_controls";
rev = "v${version}";
hash = "sha256-aapODSWPB98I/ieUTXIO7nrd11VY9SmFpsVR1ketsZU=";
};
patches = [
# Standardize installation with pypa/build. See:
# https://github.com/digitaltrails/vdu_controls/pull/120
(fetchpatch {
url = "https://github.com/digitaltrails/vdu_controls/commit/ef2ed07398fc88ccc18a11da3cf5ea1500a03cb6.patch";
hash = "sha256-W0Iv3RXQFnHAzaXHh6ZvGARN4ShsNgOhg9FTpbvnfLo=";
})
];
build-system = [
python3.pkgs.setuptools
python3.pkgs.sphinx
];
# Replace FHS paths with out paths. Unfortunately it will be pretty hard to
# change this behavior upstream, as they barely use any packaging system
# whatsoever.
preBuild = ''
substituteInPlace vdu_controls.py \
--replace-fail /usr/share/vdu_controls $out/share/vdu_controls
'';
nativeBuildInputs = [
qt6.wrapQtAppsHook
copyDesktopItems
installShellFiles
];
desktopItems = "vdu_controls.desktop";
postInstall = ''
install -Dm066 vdu_controls.png $out/share/icons/hicolor/256x256/apps/vdu_controls.png
make -C docs man
installManPage docs/_build/man/vdu_controls.1
mkdir -p $out/share/vdu_controls
cp -r icons $out/share/vdu_controls
cp -r sample-scripts $out/share/vdu_controls
cp -r translations $out/share/vdu_controls
'';
dependencies = [
python3.pkgs.pyqt6
];
buildInputs = [
qt6.qtbase
qt6.qtwayland
];
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
meta = {
description = "VDU controls - a control panel for monitor brightness/contrast";
homepage = "https://github.com/digitaltrails/vdu_controls";
license = lib.licenses.gpl3Only;
mainProgram = "vdu_controls";
};
}