nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 wine64Packages,
5 fetchpatch,
6 fetchFromGitHub,
7 glib,
8 makeBinaryWrapper,
9 pkg-config,
10 cairo,
11 gdk-pixbuf,
12 graphene,
13 gtk4,
14 libadwaita,
15 libGL,
16 libxkbcommon,
17 pango,
18 vulkan-headers,
19 vulkan-loader,
20 wayland,
21 winetricks,
22 xorg,
23 symlinkJoin,
24 nix-update-script,
25}:
26let
27 wine =
28 (wine64Packages.staging.override {
29 dbusSupport = true;
30 embedInstallers = true;
31 pulseaudioSupport = true;
32 x11Support = true;
33 waylandSupport = true;
34 }).overrideAttrs
35 (oldAttrs: {
36 # https://github.com/flathub/org.vinegarhq.Vinegar/blob/a3c2f1249dec9548bd870027f55edcc58343b685/wine.yml#L31-L38
37 # --with-wayland is added by waylandSupport = true;
38 configureFlags = oldAttrs.configureFlags or [ ] ++ [
39 "--disable-tests"
40 "--disable-win16"
41 "--with-dbus"
42 "--with-pulse"
43 "--with-x"
44 "--without-oss"
45 ];
46
47 patches = oldAttrs.patches or [ ] ++ [
48 (fetchpatch {
49 name = "loader-prefer-winedllpath.patch";
50 url = "https://raw.githubusercontent.com/flathub/org.vinegarhq.Vinegar/3e07606350d803fa386eb4c358836a230819380d/patches/wine/loader-prefer-winedllpath.patch";
51 hash = "sha256-89wnr2rIbyw490hHwckB9g1GKCXm6BERnplfwEUlNOg=";
52 })
53 ];
54
55 postInstall = ''
56 cp $out/bin/wine $out/bin/wine64
57 '';
58 });
59in
60buildGoModule (finalAttrs: {
61 pname = "vinegar";
62 version = "1.8.1";
63
64 src = fetchFromGitHub {
65 owner = "vinegarhq";
66 repo = "vinegar";
67 tag = "v${finalAttrs.version}";
68 hash = "sha256-7rc6LKZx0OOZDedtTpHIQT4grx1FejRiVnJnVDUddy4=";
69 };
70
71 vendorHash = "sha256-TZhdwHom4DTgLs4z/eADeoKakMtyFrvVljDg4JJp7dc=";
72
73 nativeBuildInputs = [
74 glib
75 makeBinaryWrapper
76 pkg-config
77 ];
78
79 buildInputs = [
80 cairo
81 gdk-pixbuf
82 glib.out
83 graphene
84 gtk4
85 libadwaita
86 libGL
87 libxkbcommon
88 pango.out
89 vulkan-headers
90 vulkan-loader
91 wayland
92 wine
93 winetricks
94 xorg.libX11
95 xorg.libXcursor
96 xorg.libXfixes
97 ];
98
99 postPatch = ''
100 substituteInPlace Makefile --replace-fail 'gtk-update-icon-cache' '${lib.getExe' gtk4 "gtk4-update-icon-cache"}'
101 '';
102
103 buildPhase = ''
104 runHook preBuild
105
106 make PREFIX=$out
107
108 runHook postBuild
109 '';
110
111 # Add getGoDirs to checkPhase since it is not being provided by the buildPhase
112 preCheck = ''
113 getGoDirs() {
114 local type;
115 type="$1"
116 if [ -n "$subPackages" ]; then
117 echo "$subPackages" | sed "s,\(^\| \),\1./,g"
118 else
119 find . -type f -name \*$type.go -exec dirname {} \; | grep -v "/vendor/" | sort --unique | grep -v "$exclude"
120 fi
121 }
122 '';
123
124 installPhase = ''
125 runHook preInstall
126
127 make PREFIX=$out install
128
129 runHook postInstall
130 '';
131
132 postInstall = ''
133 wrapProgram $out/bin/vinegar \
134 --prefix PATH : ${
135 lib.makeBinPath [
136 wine
137 winetricks
138 ]
139 } \
140 --set-default PUREGOTK_LIB_FOLDER ${finalAttrs.passthru.libraryPath}/lib
141 '';
142
143 passthru = {
144 libraryPath = symlinkJoin {
145 name = "vinegar-puregotk-lib-folder";
146 paths = [
147 cairo
148 gdk-pixbuf
149 glib.out
150 graphene
151 gtk4
152 libadwaita
153 pango.out
154 vulkan-loader
155 ];
156 };
157
158 updateScript = nix-update-script { };
159 };
160
161 meta = {
162 changelog = "https://github.com/vinegarhq/vinegar/releases/tag/v${finalAttrs.version}";
163 description = "Open-source, minimal, configurable, fast bootstrapper for running Roblox Studio on Linux";
164 homepage = "https://github.com/vinegarhq/vinegar";
165 license = lib.licenses.gpl3Only;
166 mainProgram = "vinegar";
167 maintainers = with lib.maintainers; [ HeitorAugustoLN ];
168 platforms = [ "x86_64-linux" ];
169 sourceProvenance = [ lib.sourceTypes.fromSource ];
170 };
171})