3
0
Fork 0
forked from mirrors/nixpkgs

edid-generator: 2018-03-15 -> 2023-11-20

also:
- fixes and gives actually working example of `overrideAttrs`
- ensures it works with `hardware.firmware` option
- split into phases
- adds `checkPhase` and applies patch fixing it https://github.com/akatrevorjay/edid-generator/pull/29
pre-commit-hooks.nix: init
This commit is contained in:
Krzysztof Nazarewski 2023-11-15 12:28:22 +01:00
parent e44462d602
commit 7333ef5b8f
No known key found for this signature in database
GPG key ID: 985C1ACE088CC9F4

View file

@ -5,43 +5,63 @@
, edid-decode , edid-decode
, hexdump , hexdump
, zsh , zsh
, modelines ? [ ] # Modeline "1280x800" 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync
, clean ? false # should it skip all, but explicitly listed modelines?
}: }:
# Usage: # Usage:
# (edid-generator.override { # hardware.firmware = [(edid-generator.overrideAttrs {
# clean = true; # clean = true;
# modelines = [ # modelines = ''
# ''Modeline "PG278Q_2560x1440" 241.50 2560 2608 2640 2720 1440 1443 1448 1481 -hsync +vsync'' # Modeline "PG278Q_60" 241.50 2560 2608 2640 2720 1440 1443 1448 1481 -hsync +vsync
# ''Modeline "PG278Q_2560x1440@120" 497.75 2560 2608 2640 2720 1440 1443 1448 1525 +hsync -vsync'' # Modeline "PG278Q_120" 497.75 2560 2608 2640 2720 1440 1443 1448 1525 +hsync -vsync
# ''Modeline "U2711_2560x1440" 241.50 2560 2600 2632 2720 1440 1443 1448 1481 -hsync +vsync'' # Modeline "U2711_60" 241.50 2560 2600 2632 2720 1440 1443 1448 1481 -hsync +vsync
# ]; # '';
# }) # })];
stdenv.mkDerivation rec { stdenv.mkDerivation {
pname = "edid-generator"; pname = "edid-generator";
version = "unstable-2018-03-15"; version = "master-2023-11-20";
# so `hardware.firmware` doesn't compress it
compressFirmware = false;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "akatrevorjay"; owner = "akatrevorjay";
repo = "edid-generator"; repo = "edid-generator";
rev = "31a6f80784d289d2faa8c4ca4788409c83b3ea14"; rev = "476a016d8b488df749bf6d6efbf7b9fbfb2e3cb8";
sha256 = "0j6wqzx5frca8b5i6812vvr5iwk7440fka70bmqn00k0vfhsc2x3"; sha256 = "sha256-UGxze273VB5cQDWrv9X/Lam6WbOu9U3bro8GcVbEvws=";
}; };
nativeBuildInputs = [ dos2unix edid-decode hexdump zsh ]; nativeBuildInputs = [ dos2unix edid-decode hexdump zsh ];
postPatch = '' postPatch = ''
patchShebangs modeline2edid patchShebangs modeline2edid
# allows makefile to discover prefixes and suffixes in addition to just `[0-9]*x[0-9]*.S`
awk -i inplace '/^SOURCES\t/ { print "SOURCES\t:= $(wildcard *[0-9]*x[0-9]**.S)"; next; }; { print; }' Makefile
''; '';
passAsFile = [ "modelines" ];
clean = false;
modelines = "";
configurePhase = '' configurePhase = ''
test '${toString clean}' != 1 || rm *x*.S test "$clean" != 1 || rm *x*.S
${lib.concatMapStringsSep "\n" (m: "./modeline2edid - <<<'${m}'") modelines} ./modeline2edid - <"$modelinesPath"
make clean all
for file in *.S ; do
echo "--- generated file: $file"
cat "$file"
done
make clean
'';
buildPhase = ''
make all
'';
doCheck = true;
checkPhase = ''
for file in *.bin ; do
echo "validating $file"
edid-decode <"$file"
done
''; '';
installPhase = '' installPhase = ''
@ -51,7 +71,7 @@ stdenv.mkDerivation rec {
meta = { meta = {
description = "Hackerswork to generate an EDID blob from given Xorg Modelines"; description = "Hackerswork to generate an EDID blob from given Xorg Modelines";
homepage = "https://github.com/akatrevorjay/edid-generator"; homepage = "https://github.com/akatrevorjay/edid-generator";
license = lib.licenses.mit; license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ flokli nazarewk ]; maintainers = with lib.maintainers; [ flokli nazarewk ];
platforms = lib.platforms.all; platforms = lib.platforms.all;
broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/edid-generator.x86_64-darwin broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/edid-generator.x86_64-darwin