jetbrains: useFetchCargoVendor (#377020)
[NixPkgs.git] / pkgs / by-name / sw / switchres / package.nix
blob9457b0f2a0696b52f5c88edc6a2e90347f399b58
2   stdenv,
3   lib,
4   pkg-config,
5   fetchFromGitHub,
6   xorg,
7   libdrm,
8   SDL2,
9 }:
11 stdenv.mkDerivation (finalAttrs: {
12   pname = "switchres";
13   version = "2.2.1";
15   src = fetchFromGitHub {
16     owner = "antonioginer";
17     repo = "switchres";
18     tag = "v${finalAttrs.version}";
19     hash = "sha256-/21RcpumWYNBPck7gpH6krwC3Thz/rKDPgeJblN2BDA=";
20   };
22   nativeBuildInputs = [
23     pkg-config
24   ];
26   buildInputs = [
27     xorg.libXrandr
28     xorg.xorgproto
29     libdrm
30     SDL2
31   ];
33   patchPhase = ''
34     runHook preHook
36     substituteInPlace ./custom_video_xrandr.cpp \
37       --replace-fail libX11.so ${xorg.libX11}/lib/libX11.so \
38       --replace-fail libXrandr.so ${xorg.libXrandr}/lib/libXrandr.so
40     substituteInPlace ./custom_video_drmkms.cpp \
41       --replace-fail libdrm.so ${libdrm}/lib/libdrm.so \
43     runHook postHook
44   '';
46   env = {
47     PREFIX = "$(out)";
48   };
50   preInstall = ''
51     install -Dm755 switchres $out/bin/switchres
52   '';
54   meta = {
55     description = "Modeline generation engine for emulation";
56     homepage = "https://github.com/antonioginer/switchres";
57     changelog = "https://github.com/antonioginer/switchres/releases/tag/v${finalAttrs.version}";
58     license = lib.licenses.gpl2Only;
59     mainProgram = "switchres";
60     maintainers = with lib.maintainers; [ bot-wxt1221 ];
61     platforms = lib.platforms.linux;
62   };