38 lines
902 B
Nix
38 lines
902 B
Nix
{ lib, stdenv, zig, xorg }:
|
|
|
|
stdenv.mkDerivation {
|
|
pname = "hdmi-relink";
|
|
version = "0.4.0";
|
|
|
|
src = ./src;
|
|
|
|
nativeBuildInputs = [ zig ];
|
|
buildInputs = [ xorg.libxcb ];
|
|
|
|
# build-exe rather than `zig build`: this is one dependency-free file, and it
|
|
# avoids build.zig.zon, whose schema has churned across zig releases
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-cache"
|
|
zig build-exe main.zig \
|
|
-OReleaseSafe -lc \
|
|
-I${lib.getDev xorg.libxcb}/include \
|
|
-L${lib.getLib xorg.libxcb}/lib \
|
|
-lxcb -lxcb-randr -lxcb-dpms -lxcb-screensaver \
|
|
--name hdmi-relink
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -Dm755 hdmi-relink $out/bin/hdmi-relink
|
|
runHook postInstall
|
|
'';
|
|
|
|
meta = {
|
|
description = "Re-initialise a wedged HDMI TMDS link on wake";
|
|
mainProgram = "hdmi-relink";
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
}
|