about summary refs log tree commit diff
path: root/pkgs/by-name/vi/vinegar/package.nix
blob: f192e13cc4891ad41646a3bd3651471a6f1fa31b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{ lib
, buildGoModule
, fetchFromGitHub
, makeBinaryWrapper
, pkg-config
, libGL
, libxkbcommon
, xorg
, wayland
, vulkan-headers
, wine64Packages
, fetchpatch
, fetchFromGitLab
, fetchurl
,
}:
let
  stagingPatch = fetchFromGitLab {
    sha256 = "sha256-VQ4j4PuXRoXbCUZ16snVO+jRvuKD4Rjn14R7bhwdAco=";
    domain = "gitlab.winehq.org";
    owner = "wine";
    repo = "wine-staging";
    rev = "v9.2";
  };

  wine = wine64Packages.staging.overrideDerivation (oldAttrs: {
    prePatch = ''
      patchShebangs tools
      cp -r ${stagingPatch}/patches ${stagingPatch}/staging .
      chmod +w patches
      patchShebangs ./patches/gitapply.sh
      python3 ./staging/patchinstall.py --destdir="$PWD" --all
    '';
    patches = (oldAttrs.patches or [ ])
      ++ [
      (fetchurl {
        name = "childwindow.patch";
        hash = "sha256-u3mDvlbhQnfh2tUKb8jNJA0tTcLIaKVLfY8ktJmeRns=";
        url = "https://raw.githubusercontent.com/flathub/org.vinegarhq.Vinegar/9f43ce33a691afb50562d95adfc6719a3b58ddb7/patches/wine/childwindow.patch";
      })
      (fetchpatch {
        name = "mouselock.patch";
        hash = "sha256-0AGA4AQbxTL5BGVbm072moav7xVA3zpotYqM8pcEDa4=";
        url = "https://raw.githubusercontent.com/flathub/org.vinegarhq.Vinegar/9f43ce33a691afb50562d95adfc6719a3b58ddb7/patches/wine/mouselock.patch";
      })
      (fetchpatch {
        name = "segregrevert.patch";
        hash = "sha256-+3Nld81nG3GufI4jAF6yrWfkJmsSCOku39rx0Hov29c=";
        url = "https://raw.githubusercontent.com/flathub/org.vinegarhq.Vinegar/9f43ce33a691afb50562d95adfc6719a3b58ddb7/patches/wine/segregrevert.patch";
      })
    ];
    src = fetchFromGitLab rec {
      sha256 = "sha256-GlPH34dr9aHx7xvlcbtDMn/wrY//DP58ilXjhQXgihQ=";
      domain = "gitlab.winehq.org";
      owner = "wine";
      repo = "wine";
      rev = "wine-9.2";
    };
  });
in
buildGoModule rec {
  pname = "vinegar";
  version = "1.7.4";

  src = fetchFromGitHub {
    owner = "vinegarhq";
    repo = "vinegar";
    rev = "v${version}";
    hash = "sha256-4tkcrUzW8la5WiDtGUvvsRzFqZM1gqnWWAzXc82hirM=";
  };

  vendorHash = "sha256-pi9FjKYXH8cqTx2rTRCyT4+pOM5HnIKosEcmcpbuywQ=";

  nativeBuildInputs = [ pkg-config makeBinaryWrapper ];
  buildInputs = [ libGL libxkbcommon xorg.libX11 xorg.libXcursor xorg.libXfixes wayland vulkan-headers wine ];

  buildPhase = ''
    runHook preBuild
    make PREFIX=$out
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    make PREFIX=$out install
    runHook postInstall
  '';

  postInstall = ''
    wrapProgram $out/bin/vinegar \
      --prefix PATH : ${lib.makeBinPath [wine]}
  '';

  meta = with lib; {
    description = "Open-source, minimal, configurable, fast bootstrapper for running Roblox on Linux";
    homepage = "https://github.com/vinegarhq/vinegar";
    changelog = "https://github.com/vinegarhq/vinegar/releases/tag/v${version}";
    mainProgram = "vinegar";
    license = licenses.gpl3Only;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ nyanbinary ];
  };
}