diff --git a/pkgs/by-name/li/light/0001-define-light-loglevel-as-extern.patch b/pkgs/by-name/li/light/0001-define-light-loglevel-as-extern.patch new file mode 100644 index 000000000000..082f8f3f10e1 --- /dev/null +++ b/pkgs/by-name/li/light/0001-define-light-loglevel-as-extern.patch @@ -0,0 +1,38 @@ +From 47f163f6bcd1d66bebc49d96abcf46853a0708fb Mon Sep 17 00:00:00 2001 +From: wxt <3264117476@qq.com> +Date: Tue, 22 Oct 2024 07:48:34 +0800 +Subject: [PATCH] fix build + +--- + src/helpers.c | 1 + + src/helpers.h | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/helpers.c b/src/helpers.c +index c7bc4de..00e6098 100644 +--- a/src/helpers.c ++++ b/src/helpers.c +@@ -9,6 +9,7 @@ + #include // errno + #include // dirname + ++light_loglevel_t light_loglevel; + + bool light_file_read_uint64(char const *filename, uint64_t *val) + { +diff --git a/src/helpers.h b/src/helpers.h +index f73714b..4a92753 100644 +--- a/src/helpers.h ++++ b/src/helpers.h +@@ -21,7 +21,7 @@ typedef enum { + LIGHT_NOTE_LEVEL + } light_loglevel_t; + +-light_loglevel_t light_loglevel; ++extern light_loglevel_t light_loglevel; + + #define LIGHT_LOG(lvl, fp, fmt, args...)\ + if(light_loglevel >= lvl)\ +-- +2.46.1 + diff --git a/pkgs/by-name/li/light/package.nix b/pkgs/by-name/li/light/package.nix new file mode 100644 index 000000000000..aa16262a8d93 --- /dev/null +++ b/pkgs/by-name/li/light/package.nix @@ -0,0 +1,47 @@ +{ + lib, + stdenv, + fetchFromGitLab, + fetchpatch, + autoreconfHook, + coreutils, +}: + +stdenv.mkDerivation { + version = "1.2.2"; + pname = "light"; + + src = fetchFromGitLab { + owner = "dpeukert"; + repo = "light"; + rev = "2a54078cbe3814105ee4f565f451b1b5947fbde0"; + hash = "sha256-OmHdVJvBcBjJiPs45JqOHxFoJYvKIEIpt9pFhBz74Kg="; + }; + + configureFlags = [ "--with-udev" ]; + + nativeBuildInputs = [ autoreconfHook ]; + + patches = [ + ./0001-define-light-loglevel-as-extern.patch + ]; + + # ensure udev rules can find the commands used + postPatch = '' + substituteInPlace 90-backlight.rules \ + --replace-fail '/bin/chgrp' '${coreutils}/bin/chgrp' \ + --replace-fail '/bin/chmod' '${coreutils}/bin/chmod' + ''; + + meta = { + description = "GNU/Linux application to control backlights"; + homepage = "https://gitlab.com/dpeukert/light"; + license = lib.licenses.gpl3Only; + mainProgram = "light"; + maintainers = with lib.maintainers; [ + puffnfresh + dtzWill + ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/os-specific/linux/light/default.nix b/pkgs/os-specific/linux/light/default.nix deleted file mode 100644 index 41442b372576..000000000000 --- a/pkgs/os-specific/linux/light/default.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - fetchpatch, - autoreconfHook, - coreutils, -}: - -stdenv.mkDerivation (finalAttrs: { - version = "1.2.2"; - pname = "light"; - src = fetchFromGitHub { - owner = "haikarainen"; - repo = "light"; - rev = "refs/tags/v${version}"; - sha256 = "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s"; - }; - - patches = [ - # Pull upstream fix for -fno-common toolchains: - # https://github.com/haikarainen/light/pull/135 - (fetchpatch { - name = "fno-common.patch"; - url = "https://github.com/haikarainen/light/commit/eae912ca7ff3356805e47739114861d2b6ae7ec0.patch"; - sha256 = "15jp8hm5scl0myiy1jmvd6m52lhx5jscvi3rgb5siwakmnkgzx9j"; - }) - ]; - - configureFlags = [ "--with-udev" ]; - - nativeBuildInputs = [ autoreconfHook ]; - - # ensure udev rules can find the commands used - postPatch = '' - substituteInPlace 90-backlight.rules \ - --replace '/bin/chgrp' '${coreutils}/bin/chgrp' \ - --replace '/bin/chmod' '${coreutils}/bin/chmod' - ''; - - meta = { - description = "GNU/Linux application to control backlights"; - homepage = "https://haikarainen.github.io/light/"; - license = lib.licenses.gpl3; - mainProgram = "light"; - maintainers = with lib.maintainers; [ - puffnfresh - dtzWill - ]; - platforms = lib.platforms.linux; - }; -}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0f17b22d3023..4183b3c193cc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25413,8 +25413,6 @@ with pkgs; then util-linuxMinimal else null; - light = callPackage ../os-specific/linux/light { }; - lightum = callPackage ../os-specific/linux/lightum { }; ebtables = callPackage ../os-specific/linux/ebtables { };