summary refs log tree commit diff
path: root/pkgs/applications/misc
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2019-08-12 18:18:05 +0200
committerGitHub <noreply@github.com>2019-08-12 18:18:05 +0200
commita7c7bb156f1125fc82ef71c46a1e8b89a6ed253b (patch)
tree80b770a25c0deff8231d17523666a29c9c0e4e93 /pkgs/applications/misc
parent5d807f80c78c65c560c410b4e284988bd75fcc30 (diff)
parent7c8ea897be91758787dea1c3280974c7cdf7df9b (diff)
downloadnixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.tar
nixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.tar.gz
nixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.tar.bz2
nixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.tar.lz
nixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.tar.xz
nixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.tar.zst
nixpkgs-a7c7bb156f1125fc82ef71c46a1e8b89a6ed253b.zip
clight: init (#64309)
clight: init
Diffstat (limited to 'pkgs/applications/misc')
-rw-r--r--pkgs/applications/misc/clight/clightd.nix75
-rw-r--r--pkgs/applications/misc/clight/default.nix57
2 files changed, 132 insertions, 0 deletions
diff --git a/pkgs/applications/misc/clight/clightd.nix b/pkgs/applications/misc/clight/clightd.nix
new file mode 100644
index 00000000000..43ff1d73f78
--- /dev/null
+++ b/pkgs/applications/misc/clight/clightd.nix
@@ -0,0 +1,75 @@
+{ lib, stdenv, fetchFromGitHub
+, dbus, cmake, pkgconfig
+, glib, udev, polkit, libmodule
+, pcre, libXdmcp, utillinux, libpthreadstubs
+, enableDdc ? true, ddcutil
+, enableDpms ? true, libXext
+, enableGamma ? true, libXrandr
+, enableScreen ? true }:
+
+stdenv.mkDerivation rec {
+  pname = "clightd";
+  version = "3.4";
+
+  src = fetchFromGitHub {
+    owner = "FedeDP";
+    repo = "Clightd";
+    rev = version;
+    sha256 = "0g6kawizwfhvigkwm7rbfq6rg872xn8igy8n355w4d7mmcxk0jf8";
+  };
+
+  # dbus-1.pc has datadir=/etc
+  SYSTEM_BUS_DIR = "${placeholder "out"}/share/dbus-1/system-services";
+  # systemd.pc has prefix=${systemd.out}
+  MODULE_LOAD_DIR = "${placeholder "out"}/lib/modules-load.d";
+  # polkit-gobject-1.pc has prefix=${polkit.out}
+  POLKIT_ACTION_DIR = "${placeholder "out"}/share/polkit-1/actions";
+
+  postPatch = ''
+    sed -i "s@/etc@$out\0@" CMakeLists.txt
+    sed -i "s@pkg_get_variable(SYSTEM_BUS_DIR.*@set(SYSTEM_BUS_DIR $SYSTEM_BUS_DIR)@" CMakeLists.txt
+    sed -i "s@pkg_get_variable(MODULE_LOAD_DIR.*@set(MODULE_LOAD_DIR $MODULE_LOAD_DIR)@" CMakeLists.txt
+    sed -i "s@pkg_get_variable(POLKIT_ACTION_DIR.*@set(POLKIT_ACTION_DIR $POLKIT_ACTION_DIR)@" CMakeLists.txt
+  '';
+
+  cmakeFlags = with lib;
+     optional enableDdc "-DENABLE_DDC=1"
+  ++ optional enableDpms "-DENABLE_DPMS=1"
+  ++ optional enableGamma "-DENABLE_GAMMA=1"
+  ++ optional enableScreen "-DENABLE_SCREEN=1";
+
+  nativeBuildInputs = [
+    dbus
+    cmake
+    pkgconfig
+  ];
+
+  buildInputs = with lib; [
+    glib
+    udev
+    polkit
+    libmodule
+
+    pcre
+    libXdmcp
+    utillinux
+    libpthreadstubs
+  ] ++ optional enableDdc ddcutil
+    ++ optional enableDpms libXext
+    ++ optional enableGamma libXrandr;
+
+  postInstall = ''
+    mkdir -p $out/bin
+    ln -svT $out/lib/clightd/clightd $out/bin/clightd
+  '';
+
+  meta = with lib; {
+    description = "Linux bus interface that changes screen brightness/temperature";
+    homepage = https://github.com/FedeDP/Clightd;
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [
+      eadwu
+    ];
+  };
+}
diff --git a/pkgs/applications/misc/clight/default.nix b/pkgs/applications/misc/clight/default.nix
new file mode 100644
index 00000000000..829fd4e1223
--- /dev/null
+++ b/pkgs/applications/misc/clight/default.nix
@@ -0,0 +1,57 @@
+{ lib, stdenv, fetchFromGitHub
+, dbus, cmake, pkgconfig, bash-completion
+, gsl, popt, clightd, systemd, libconfig
+, withGeoclue ? true, geoclue2
+, withUpower ? true, upower }:
+
+stdenv.mkDerivation rec {
+  pname = "clight";
+  version = "3.1";
+
+  src = fetchFromGitHub {
+    owner = "FedeDP";
+    repo = "Clight";
+    rev = version;
+    sha256 = "0rzcr1x9h4llnmklhgzs9r7xwhsrw1qkqvfffkp8fs90nycaqx81";
+  };
+
+  # bash-completion.pc completionsdir=${bash-completion.out}
+  COMPLETIONS_DIR = "${placeholder "out"}/share/bash-completions/completions";
+  # dbus-1.pc has datadir=/etc
+  SESSION_BUS_DIR = "${placeholder "out"}/share/dbus-1/services";
+
+  postPatch = ''
+    sed -i "s@/usr@$out@" CMakeLists.txt
+    sed -i "s@/etc@$out\0@" CMakeLists.txt
+    sed -i "s@pkg_get_variable(COMPLETIONS_DIR.*@set(COMPLETIONS_DIR $COMPLETIONS_DIR)@" CMakeLists.txt
+    sed -i "s@pkg_get_variable(SESSION_BUS_DIR.*@set(SESSION_BUS_DIR $SESSION_BUS_DIR)@" CMakeLists.txt
+  '';
+
+  nativeBuildInputs = [
+    dbus
+    cmake
+    pkgconfig
+    bash-completion
+  ];
+
+  buildInputs = with lib; [
+    gsl
+    popt
+    upower
+    clightd
+    systemd
+    geoclue2
+    libconfig
+  ] ++ optional withGeoclue geoclue2
+    ++ optional withUpower upower;
+
+  meta = with lib; {
+    description = "A C daemon that turns your webcam into a light sensor";
+    homepage = https://github.com/FedeDP/Clight;
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [
+      eadwu
+    ];
+  };
+}