Unverified Commit 79a4cb99 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

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

parents 9ecd11df 787aa8b7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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
    ];
  };
}
})
+46 −0
Original line number Diff line number Diff line
{
  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;
  };
})
Loading