tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
spaghettikart: init at 0-unstable-2025-08-07
qubitnano
5 months ago
210106ef
09906cab
+323
3 changed files
expand all
collapse all
unified
split
pkgs
by-name
sp
spaghettikart
dont-fetch-stb.patch
git-deps.patch
package.nix
+16
pkgs/by-name/sp/spaghettikart/dont-fetch-stb.patch
···
1
1
+
Submodule libultraship contains modified content
2
2
+
diff --git a/libultraship/cmake/dependencies/common.cmake b/libultraship/cmake/dependencies/common.cmake
3
3
+
index 596158c..c62d7b2 100644
4
4
+
--- a/libultraship/cmake/dependencies/common.cmake
5
5
+
+++ b/libultraship/cmake/dependencies/common.cmake
6
6
+
@@ -47,10 +47,6 @@ set(stormlib_optimizations_patch git apply ${CMAKE_CURRENT_SOURCE_DIR}/cmake/dep
7
7
+
endif()
8
8
+
9
9
+
#=================== STB ===================
10
10
+
-set(STB_DIR ${CMAKE_BINARY_DIR}/_deps/stb)
11
11
+
-file(DOWNLOAD "https://github.com/nothings/stb/raw/0bc88af4de5fb022db643c2d8e549a0927749354/stb_image.h" "${STB_DIR}/stb_image.h")
12
12
+
-file(WRITE "${STB_DIR}/stb_impl.c" "#define STB_IMAGE_IMPLEMENTATION\n#include \"stb_image.h\"")
13
13
+
-
14
14
+
add_library(stb STATIC)
15
15
+
16
16
+
target_sources(stb PRIVATE
+44
pkgs/by-name/sp/spaghettikart/git-deps.patch
···
1
1
+
diff --git a/torch/CMakeLists.txt b/torch/CMakeLists.txt
2
2
+
index ba3859a..cf3da99 100644
3
3
+
--- a/torch/CMakeLists.txt
4
4
+
+++ b/torch/CMakeLists.txt
5
5
+
@@ -36,8 +36,7 @@ if(USE_STANDALONE)
6
6
+
# Because libgfxd is not a CMake project, we have to manually fetch it and add it to the build
7
7
+
FetchContent_Declare(
8
8
+
libgfxd
9
9
+
- GIT_REPOSITORY https://github.com/glankk/libgfxd.git
10
10
+
- GIT_TAG 96fd3b849f38b3a7c7b7f3ff03c5921d328e6cdf
11
11
+
+ URL @libgfxd_src@
12
12
+
)
13
13
+
14
14
+
FetchContent_GetProperties(libgfxd)
15
15
+
@@ -205,8 +204,7 @@ set(YAML_CPP_BUILD_TESTS OFF)
16
16
+
set(YAML_CPP_DISABLE_UNINSTALL ON)
17
17
+
FetchContent_Declare(
18
18
+
yaml-cpp
19
19
+
- GIT_REPOSITORY https://github.com/jbeder/yaml-cpp.git
20
20
+
- GIT_TAG 2f86d13775d119edbb69af52e5f566fd65c6953b
21
21
+
+ URL @yaml-cpp_src@
22
22
+
)
23
23
+
set(YAML_CPP_BUILD_TESTS OFF)
24
24
+
FetchContent_MakeAvailable(yaml-cpp)
25
25
+
@@ -219,8 +217,7 @@ endif()
26
26
+
if(USE_STANDALONE)
27
27
+
FetchContent_Declare(
28
28
+
spdlog
29
29
+
- GIT_REPOSITORY https://github.com/gabime/spdlog.git
30
30
+
- GIT_TAG 7e635fca68d014934b4af8a1cf874f63989352b7
31
31
+
+ URL @spdlog_src@
32
32
+
)
33
33
+
34
34
+
FetchContent_MakeAvailable(spdlog)
35
35
+
@@ -234,8 +231,7 @@ endif()
36
36
+
set(tinyxml2_BUILD_TESTING OFF)
37
37
+
FetchContent_Declare(
38
38
+
tinyxml2
39
39
+
- GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
40
40
+
- GIT_TAG 10.0.0
41
41
+
+ URL @tinyxml2_src@
42
42
+
OVERRIDE_FIND_PACKAGE
43
43
+
)
44
44
+
FetchContent_MakeAvailable(tinyxml2)
+263
pkgs/by-name/sp/spaghettikart/package.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
fetchFromGitHub,
4
4
+
applyPatches,
5
5
+
writeTextFile,
6
6
+
fetchurl,
7
7
+
stdenv,
8
8
+
replaceVars,
9
9
+
yaml-cpp,
10
10
+
srcOnly,
11
11
+
cmake,
12
12
+
copyDesktopItems,
13
13
+
installShellFiles,
14
14
+
lsb-release,
15
15
+
makeWrapper,
16
16
+
ninja,
17
17
+
pkg-config,
18
18
+
libGL,
19
19
+
libvorbis,
20
20
+
libX11,
21
21
+
libzip,
22
22
+
nlohmann_json,
23
23
+
SDL2,
24
24
+
SDL2_net,
25
25
+
spdlog,
26
26
+
tinyxml-2,
27
27
+
zenity,
28
28
+
sdl_gamecontrollerdb,
29
29
+
spaghettikart,
30
30
+
makeDesktopItem,
31
31
+
}:
32
32
+
33
33
+
let
34
34
+
35
35
+
# The following are either normally fetched during build time or a specific version is required
36
36
+
37
37
+
dr_libs = fetchFromGitHub {
38
38
+
owner = "mackron";
39
39
+
repo = "dr_libs";
40
40
+
rev = "da35f9d6c7374a95353fd1df1d394d44ab66cf01";
41
41
+
hash = "sha256-ydFhQ8LTYDBnRTuETtfWwIHZpRciWfqGsZC6SuViEn0=";
42
42
+
};
43
43
+
44
44
+
imgui' = applyPatches {
45
45
+
src = fetchFromGitHub {
46
46
+
owner = "ocornut";
47
47
+
repo = "imgui";
48
48
+
tag = "v1.91.9b-docking";
49
49
+
hash = "sha256-mQOJ6jCN+7VopgZ61yzaCnt4R1QLrW7+47xxMhFRHLQ=";
50
50
+
};
51
51
+
patches = [
52
52
+
"${spaghettikart.src}/libultraship/cmake/dependencies/patches/imgui-fixes-and-config.patch"
53
53
+
];
54
54
+
};
55
55
+
56
56
+
libgfxd = fetchFromGitHub {
57
57
+
owner = "glankk";
58
58
+
repo = "libgfxd";
59
59
+
rev = "008f73dca8ebc9151b205959b17773a19c5bd0da";
60
60
+
hash = "sha256-AmHAa3/cQdh7KAMFOtz5TQpcM6FqO9SppmDpKPTjTt8=";
61
61
+
};
62
62
+
63
63
+
prism = fetchFromGitHub {
64
64
+
owner = "KiritoDv";
65
65
+
repo = "prism-processor";
66
66
+
rev = "7ae724a6fb7df8cbf547445214a1a848aefef747";
67
67
+
hash = "sha256-G7koDUxD6PgZWmoJtKTNubDHg6Eoq8I+AxIJR0h3i+A=";
68
68
+
};
69
69
+
70
70
+
stb_impl = writeTextFile {
71
71
+
name = "stb_impl.c";
72
72
+
text = ''
73
73
+
#define STB_IMAGE_IMPLEMENTATION
74
74
+
#include "stb_image.h"
75
75
+
'';
76
76
+
};
77
77
+
78
78
+
stb' = fetchurl {
79
79
+
name = "stb_image.h";
80
80
+
url = "https://raw.githubusercontent.com/nothings/stb/0bc88af4de5fb022db643c2d8e549a0927749354/stb_image.h";
81
81
+
hash = "sha256-xUsVponmofMsdeLsI6+kQuPg436JS3PBl00IZ5sg3Vw=";
82
82
+
};
83
83
+
84
84
+
stormlib' = applyPatches {
85
85
+
src = fetchFromGitHub {
86
86
+
owner = "ladislav-zezula";
87
87
+
repo = "StormLib";
88
88
+
tag = "v9.25";
89
89
+
hash = "sha256-HTi2FKzKCbRaP13XERUmHkJgw8IfKaRJvsK3+YxFFdc=";
90
90
+
};
91
91
+
patches = [
92
92
+
"${spaghettikart.src}/libultraship/cmake/dependencies/patches/stormlib-optimizations.patch"
93
93
+
];
94
94
+
};
95
95
+
96
96
+
thread_pool = fetchFromGitHub {
97
97
+
owner = "bshoshany";
98
98
+
repo = "thread-pool";
99
99
+
tag = "v4.1.0";
100
100
+
hash = "sha256-zhRFEmPYNFLqQCfvdAaG5VBNle9Qm8FepIIIrT9sh88=";
101
101
+
};
102
102
+
103
103
+
in
104
104
+
stdenv.mkDerivation (finalAttrs: {
105
105
+
pname = "spaghettikart";
106
106
+
version = "0-unstable-2025-08-07";
107
107
+
108
108
+
src = fetchFromGitHub {
109
109
+
owner = "HarbourMasters";
110
110
+
repo = "SpaghettiKart";
111
111
+
rev = "334fdeafd26c15e03b4f198002ad86b8422c0e2f";
112
112
+
hash = "sha256-0nDaX34C7stg7S2mzPChz0fRz/t7yyevKEAPmIR+lak=";
113
113
+
fetchSubmodules = true;
114
114
+
deepClone = true;
115
115
+
postFetch = ''
116
116
+
cd $out
117
117
+
(git describe --tags HEAD 2>/dev/null || echo "") > PROJECT_VERSION
118
118
+
git log --pretty=format:%h -1 > PROJECT_VERSION_PATCH
119
119
+
rm -rf .git
120
120
+
'';
121
121
+
};
122
122
+
123
123
+
patches = [
124
124
+
# Don't fetch stb as we will patch our own
125
125
+
./dont-fetch-stb.patch
126
126
+
127
127
+
# Can't fetch these torch deps in the sandbox
128
128
+
(replaceVars ./git-deps.patch {
129
129
+
libgfxd_src = fetchFromGitHub {
130
130
+
owner = "glankk";
131
131
+
repo = "libgfxd";
132
132
+
rev = "96fd3b849f38b3a7c7b7f3ff03c5921d328e6cdf";
133
133
+
hash = "sha256-dedZuV0BxU6goT+rPvrofYqTz9pTA/f6eQcsvpDWdvQ=";
134
134
+
};
135
135
+
spdlog_src = fetchFromGitHub {
136
136
+
owner = "gabime";
137
137
+
repo = "spdlog";
138
138
+
rev = "7e635fca68d014934b4af8a1cf874f63989352b7";
139
139
+
hash = "sha256-cxTaOuLXHRU8xMz9gluYz0a93O0ez2xOxbloyc1m1ns=";
140
140
+
};
141
141
+
yaml-cpp_src = fetchFromGitHub {
142
142
+
owner = "jbeder";
143
143
+
repo = "yaml-cpp";
144
144
+
rev = "28f93bdec6387d42332220afa9558060c8016795";
145
145
+
hash = "sha256-59/s4Rqiiw7LKQw0UwH3vOaT/YsNVcoq3vblK0FiO5c=";
146
146
+
};
147
147
+
tinyxml2_src = srcOnly tinyxml-2;
148
148
+
})
149
149
+
];
150
150
+
151
151
+
# Recent builds enabled LTO which won't build with nix
152
152
+
NIX_CFLAGS_COMPILE = "-fno-lto";
153
153
+
154
154
+
nativeBuildInputs = [
155
155
+
cmake
156
156
+
copyDesktopItems
157
157
+
installShellFiles
158
158
+
lsb-release
159
159
+
makeWrapper
160
160
+
ninja
161
161
+
pkg-config
162
162
+
];
163
163
+
164
164
+
buildInputs = [
165
165
+
libGL
166
166
+
libvorbis
167
167
+
libX11
168
168
+
libzip
169
169
+
nlohmann_json
170
170
+
SDL2
171
171
+
SDL2_net
172
172
+
spdlog
173
173
+
tinyxml-2
174
174
+
zenity
175
175
+
];
176
176
+
177
177
+
cmakeFlags = [
178
178
+
(lib.cmakeFeature "CMAKE_INSTALL_PREFIX" "${placeholder "out"}")
179
179
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_DR_LIBS" "${dr_libs}")
180
180
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_IMGUI" "${imgui'}")
181
181
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBGFXD" "${libgfxd}")
182
182
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_PRISM" "${prism}")
183
183
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_STORMLIB" "${stormlib'}")
184
184
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_THREADPOOL" "${thread_pool}")
185
185
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_TINYXML2" "${tinyxml-2}")
186
186
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_YAML-CPP" "${yaml-cpp.src}")
187
187
+
];
188
188
+
189
189
+
strictDeps = true;
190
190
+
191
191
+
# Linking fails without this
192
192
+
hardeningDisable = [ "format" ];
193
193
+
194
194
+
preConfigure = ''
195
195
+
mkdir stb
196
196
+
cp ${stb'} ./stb/${stb'.name}
197
197
+
cp ${stb_impl} ./stb/${stb_impl.name}
198
198
+
substituteInPlace libultraship/cmake/dependencies/common.cmake \
199
199
+
--replace-fail "\''${STB_DIR}" "$(readlink -f ./stb)"
200
200
+
'';
201
201
+
202
202
+
postPatch = ''
203
203
+
substituteInPlace CMakeLists.txt \
204
204
+
--replace-fail "COMMAND git describe --tags" "COMMAND echo $(cat PROJECT_VERSION)" \
205
205
+
--replace-fail "COMMAND git log --pretty=format:%h -1" "COMMAND echo $(cat PROJECT_VERSION_PATCH)"
206
206
+
'';
207
207
+
208
208
+
postBuild = ''
209
209
+
cp ${sdl_gamecontrollerdb}/share/gamecontrollerdb.txt gamecontrollerdb.txt
210
210
+
./TorchExternal/src/TorchExternal-build/torch pack ../assets spaghetti.o2r o2r
211
211
+
'';
212
212
+
213
213
+
postInstall = ''
214
214
+
installBin Spaghettify
215
215
+
mkdir -p $out/share/spaghettikart
216
216
+
cp -r ../yamls $out/share/spaghettikart/
217
217
+
install -Dm644 -t $out/share/spaghettikart {spaghetti.o2r,config.yml,gamecontrollerdb.txt}
218
218
+
install -Dm644 ../icon.png $out/share/pixmaps/spaghettikart.png
219
219
+
install -Dm644 -t $out/share/licenses/spaghettikart/libgfxd ${libgfxd}/LICENSE
220
220
+
install -Dm644 -t $out/share/licenses/spaghettikart/libultraship ../libultraship/LICENSE
221
221
+
install -Dm644 -t $out/share/licenses/spaghettikart/thread_pool ${thread_pool}/LICENSE.txt
222
222
+
'';
223
223
+
224
224
+
# Unfortunately, spaghettikart really wants a writable working directory
225
225
+
# Create $HOME/.local/share/spaghettikart and symlink required files
226
226
+
227
227
+
postFixup = ''
228
228
+
wrapProgram $out/bin/Spaghettify \
229
229
+
--prefix PATH ":" ${lib.makeBinPath [ zenity ]} \
230
230
+
--run 'mkdir -p ~/.local/share/spaghettikart' \
231
231
+
--run "ln -sf $out/share/spaghettikart/spaghetti.o2r ~/.local/share/spaghettikart/spaghetti.o2r" \
232
232
+
--run "ln -sf $out/share/spaghettikart/config.yml ~/.local/share/spaghettikart/config.yml" \
233
233
+
--run "ln -sfT $out/share/spaghettikart/yamls ~/.local/share/spaghettikart/yamls" \
234
234
+
--run "ln -sf $out/share/spaghettikart/gamecontrollerdb.txt ~/.local/share/spaghettikart/gamecontrollerdb.txt" \
235
235
+
--run 'cd ~/.local/share/spaghettikart'
236
236
+
'';
237
237
+
238
238
+
desktopItems = [
239
239
+
(makeDesktopItem {
240
240
+
name = "spaghettikart";
241
241
+
icon = "spaghettikart";
242
242
+
exec = "Spaghettify";
243
243
+
comment = finalAttrs.meta.description;
244
244
+
genericName = "spaghettikart";
245
245
+
desktopName = "spaghettikart";
246
246
+
categories = [ "Game" ];
247
247
+
})
248
248
+
];
249
249
+
250
250
+
meta = {
251
251
+
homepage = "https://github.com/HarbourMasters/SpaghettiKart";
252
252
+
description = "Mario Kart 64 PC Port";
253
253
+
mainProgram = "Spaghettify";
254
254
+
platforms = [ "x86_64-linux" ];
255
255
+
maintainers = with lib.maintainers; [ qubitnano ];
256
256
+
license = with lib.licenses; [
257
257
+
# libultraship, libgfxd, thread_pool, dr_libs, prism-processor
258
258
+
mit
259
259
+
# Reverse engineering
260
260
+
unfree
261
261
+
];
262
262
+
};
263
263
+
})