mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2025-12-11 02:56:27 +00:00
feat: cubyz
This commit is contained in:
34
overlays/cubyz-bin/assets.nix
Normal file
34
overlays/cubyz-bin/assets.nix
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
version = "0-unstable-2025-09-13";
|
||||
pname = "cubyz-assets";
|
||||
src = fetchFromGitHub {
|
||||
owner = "PixelGuys";
|
||||
repo = "Cubyz-Assets";
|
||||
rev = "fc6e9a79b7806fe753799ac0ebe83735da9cd999";
|
||||
hash = "sha256-adMgfoAlyqRTIO8R42djn6FbLoDpFZDcWQdbm9f0p+A=";
|
||||
};
|
||||
|
||||
dontBuild = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp -r $src/* $out
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/PixelGuys/Cubyz-assets";
|
||||
description = "Cache for large assets, like music, used by Cubyz";
|
||||
license = lib.licenses.gpl3Only;
|
||||
mainProgram = "cubyz";
|
||||
maintainers = with lib.maintainers; [ leha44581 ];
|
||||
};
|
||||
})
|
||||
@@ -1,56 +1,121 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
autoPatchelfHook,
|
||||
fetchFromGitHub,
|
||||
callPackage,
|
||||
makeWrapper,
|
||||
libx11,
|
||||
libxcursor,
|
||||
libGL,
|
||||
alsa-lib,
|
||||
vulkan-loader,
|
||||
vulkan-validation-layers,
|
||||
vulkan-tools,
|
||||
zig,
|
||||
}:
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cubyz-bin";
|
||||
version = "0.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/PixelGuys/Cubyz/releases/download/${version}/Linux-x86_64.tar.gz";
|
||||
hash = "sha256-Rmh17XpO/CtLDobc8Jb4ojhtM7fUN+ungbVzQlIvE7U=";
|
||||
let
|
||||
# This is kinda atrocious, but it works
|
||||
# Override default zig flags
|
||||
zig_hook =
|
||||
(zig.overrideAttrs {
|
||||
version = "0.15.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ziglang";
|
||||
repo = "zig";
|
||||
rev = "bd97b66186dabb3533df1ea9eb650d7574496a59";
|
||||
hash = "sha256-EVIg01kQ3JCZxnnrk6qMJn3Gm3+BZzPs75x9Q+sxqBw=";
|
||||
};
|
||||
}).hook.overrideAttrs
|
||||
{
|
||||
zig_default_flags = "";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
version = "0.0.1";
|
||||
pname = "cubyz";
|
||||
src = fetchFromGitHub {
|
||||
owner = "pixelguys";
|
||||
repo = "cubyz";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-SbMRr4kktwagYUyVBKFZLOwgSmkPngV8NbwkJRk2Zvg=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
buildInputs = [ libx11 ];
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/opt
|
||||
cp -R Cubyz $out/opt/Cubyz
|
||||
makeWrapper $out/opt/Cubyz/Cubyz $out/bin/cubyz --run "cd $out/opt/Cubyz"
|
||||
runHook postInstall
|
||||
postPatch = ''
|
||||
ln -s ${callPackage ./deps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
|
||||
'';
|
||||
|
||||
preFixup =
|
||||
let
|
||||
libPath = lib.makeLibraryPath [
|
||||
libx11
|
||||
];
|
||||
in
|
||||
''
|
||||
patchelf \
|
||||
--set-rpath "${libPath}" \
|
||||
$out/opt/Cubyz/Cubyz
|
||||
'';
|
||||
preBuild = "
|
||||
mkdir -p ../Cubyz-libs/zig-out
|
||||
ln -s ${callPackage ./libs.nix { }}/* ../Cubyz-libs/zig-out/
|
||||
";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Voxel sandbox game with a large render distance, procedurally generated content and some cool graphical effects.";
|
||||
nativeBuildInputs = [
|
||||
zig_hook # Needed for building zig stuff
|
||||
makeWrapper # Needed for env variables
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libx11
|
||||
libGL
|
||||
vulkan-loader
|
||||
vulkan-validation-layers
|
||||
vulkan-tools
|
||||
libxcursor
|
||||
alsa-lib
|
||||
];
|
||||
|
||||
zigBuildFlags = [
|
||||
#"-j6" # Included in zig default flags
|
||||
"-Dcpu=baseline" # Included in zig default flags
|
||||
"-Drelease"
|
||||
"-Dlocal" # Use local libraries
|
||||
"-Doptimize=ReleaseSafe"
|
||||
];
|
||||
|
||||
# Symlink the assets to $out, add a desktop entry
|
||||
postBuild = ''
|
||||
mkdir -p $out/assets/cubyz
|
||||
ln -s ${callPackage ./assets.nix { }}/* $out/assets/cubyz/
|
||||
ln -s $src/assets/cubyz/* $out/assets/cubyz/
|
||||
|
||||
printf "
|
||||
[Desktop Entry]
|
||||
Name=Cubyz
|
||||
Exec=$out/bin/Cubyz
|
||||
Icon=$out/assets/cubyz/logo.png
|
||||
Type=Application
|
||||
Categories=Game;
|
||||
" > $out/cubyz.desktop
|
||||
'';
|
||||
|
||||
# Change some env variables, move a bunch of stuff under .config for modding purposes, symlink a desktop entry
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/Cubyz \
|
||||
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath finalAttrs.buildInputs}" \
|
||||
--prefix VK_LAYER_PATH : "${vulkan-validation-layers}/share/vulkan/explicit_layer.d" \
|
||||
--run "
|
||||
cd \$HOME/.config/cubyz
|
||||
mkdir -p \$HOME/.config/cubyz/logs
|
||||
mkdir -p \$HOME/.config/cubyz/assets
|
||||
[ ! -d \$HOME/.config/cubyz/assets/cubyz ] && cp -pr $out/assets/cubyz \$HOME/.config/cubyz/assets/
|
||||
|
||||
[ ! -f \$HOME/.config/cubyz/launchConfig.zon ] && printf \".{
|
||||
.cubyzDir = \\\"\$HOME/.config/cubyz\\\",
|
||||
}\" > \$HOME/.config/cubyz/launchConfig.zon
|
||||
|
||||
[ ! -l \$HOME/.local/share/applications/cubyz.desktop ] && ln -sf $out/cubyz.desktop \$HOME/.local/share/applications/cubyz.desktop
|
||||
"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/PixelGuys/Cubyz";
|
||||
maintainers = with maintainers; [ theaninova ];
|
||||
description = "Voxel sandbox game with a large render distance, procedurally generated content and some cool graphical effects";
|
||||
changelog = "https://github.com/PixelGuys/Cubyz/releases/tag/${finalAttrs.version}";
|
||||
license = lib.licenses.gpl3Only;
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "cubyz";
|
||||
maintainers = with lib.maintainers; [ leha44581 ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
67
overlays/cubyz-bin/deps.nix
Normal file
67
overlays/cubyz-bin/deps.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
# generated by zon2nix (https://github.com/nix-community/zon2nix)
|
||||
|
||||
{
|
||||
linkFarm,
|
||||
fetchzip,
|
||||
fetchgit,
|
||||
}:
|
||||
|
||||
linkFarm "zig-packages" [
|
||||
{
|
||||
name = "N-V-__8AAAI8tQKULcx4VW98BqluDNYJhHtN2OBlFw2Cm19f";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_aarch64-windows-gnu.tar.gz";
|
||||
hash = "sha256-hLn1ppvYtpj2SzPR9TnHIKUqp9cjW4Wvnpjn+hMzyFE=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAAxDUATPdad1MQC8jeiFsoXRet_SvG6acW5Dmxdh";
|
||||
path = fetchgit {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Assets/";
|
||||
rev = "e0ea686f86c008b29cd109e1bdd757ce6574eaf3";
|
||||
hash = "sha256-/Yl8z3KPK07/zedSjdQDgnWF2FWFVp+OIgWeQcepzfY=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AADJklgJD6krSuvgtV1hLIkVBhgIjmFZVB-Yzu9F8";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_aarch64-linux-musl.tar.gz";
|
||||
hash = "sha256-1OV6MNCoOnaVRWbs9Ln879ItoeMBS6hJOqG/oTCe2PQ=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAESlRAJiVpVgSi6YuJieVxeJkkCVVsorbxiSyRyZ";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_aarch64-macos-none.tar.gz";
|
||||
hash = "sha256-L2J87H61k7Ki5/EnVjNWXnsrwSVU/1WlysR/AqbstuU=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAI-aOwAGCfJiF1xWZSQ0yxGSyyuj-VO5P_UqqyJ0";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_headers.tar.gz";
|
||||
hash = "sha256-HE/C+d7H6eQcr1R0GtBijVWhGtueO6ymQV7hFIsGhbw=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAIKQlALN_67_ilCxZcxIGddSBBi7A4lVVa0jFeW9";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_x86_64-linux-musl.tar.gz";
|
||||
hash = "sha256-CVXw/7XLVP8iyLIwhQb6QWKOLAjts5VPzqj5Qg9oZJA=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAM4p1wKrLLOhfB8egk7fpA7WnEGIU46h_pKk8Xou";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_x86_64-windows-gnu.tar.gz";
|
||||
hash = "sha256-lEVL5HT6JBh1rAxk7ClbUtzPBfgNZVuDCfrPiANem2E=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AANi9PQLVH2WpYTmNnlcdBHDkNZI9yJz6fAznklHu";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/PixelGuys/Cubyz-Libs/releases/download/8/cubyz_deps_x86_64-macos-none.tar.gz";
|
||||
hash = "sha256-kowp1WD8Fa2nV9sQBrbIMHSIpNfDqphcxOLqa7nGRhE=";
|
||||
};
|
||||
}
|
||||
]
|
||||
48
overlays/cubyz-bin/libs.nix
Normal file
48
overlays/cubyz-bin/libs.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
callPackage,
|
||||
zig_0_14,
|
||||
}:
|
||||
|
||||
let
|
||||
zig = zig_0_14;
|
||||
zig_hook = zig.hook.overrideAttrs {
|
||||
zig_default_flags = "";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
version = "8";
|
||||
pname = "cubyz-libs";
|
||||
src = fetchFromGitHub {
|
||||
owner = "pixelguys";
|
||||
repo = "cubyz-libs";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-xg6nk2Oxe7PjT6CbPjDPegcZEn1P36PNc3YKLopb168=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
ln -s ${callPackage ./libsdeps.nix { }} $ZIG_GLOBAL_CACHE_DIR/p
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
zig_hook
|
||||
];
|
||||
|
||||
zigBuildFlags = [
|
||||
#"-j6" # Included in zig default flags
|
||||
"-Dcpu=baseline" # Included in zig default flags
|
||||
"-Dtarget=native-linux-musl"
|
||||
"-Doptimize=ReleaseSafe"
|
||||
];
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/PixelGuys/Cubyz-libs";
|
||||
description = "Contains libraries used in Cubyz";
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "cubyz";
|
||||
maintainers = with lib.maintainers; [ leha44581 ];
|
||||
};
|
||||
})
|
||||
59
overlays/cubyz-bin/libsdeps.nix
Normal file
59
overlays/cubyz-bin/libsdeps.nix
Normal file
@@ -0,0 +1,59 @@
|
||||
# generated by zon2nix (https://github.com/nix-community/zon2nix)
|
||||
|
||||
{
|
||||
linkFarm,
|
||||
fetchzip,
|
||||
fetchgit,
|
||||
}:
|
||||
|
||||
linkFarm "zig-packages" [
|
||||
{
|
||||
name = "N-V-__8AAHgEOgBtc1wN1FEbxkhfZ2mjZ1rElhauQ0FnJ-FT";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/KhronosGroup/SPIRV-Headers/archive/09913f088a1197aba4aefd300a876b2ebbaa3391.tar.gz";
|
||||
hash = "sha256-Q1i6i5XimULuGufP6mimwDW674anAETUiIEvDQwvg5Y=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAKLKpwC4H27Ps_0iL3bPkQb-z6ZVSrB-x_3EEkub";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-2.tar.gz";
|
||||
hash = "sha256-Io9k8xmOKrk+4GSi3PUU60X68T4BpG8dru1/KO+jVRk=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAL40TADEbrysYHBl-UIZO4KiG4chP8pLDVDINGH4";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz";
|
||||
hash = "sha256-FcnQPDeNHgov1Z07gjFze0VMz2diOrpbKZCsI96ngz0=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AALI5agF9e8bfTFSiJU8WAeG6Qu90t9vSM9tDsgeL";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/KhronosGroup/SPIRV-Tools/archive/f289d047f49fb60488301ec62bafab85573668cc.tar.gz";
|
||||
hash = "sha256-2Wv0dxVQ8NvuDRTcsXkH1GKmuA6lsIuwTl0j6kbTefo=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAMnvlQXSfQ493UdwXL4VBQdgWMtBZJM2016lE2ns";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/8.2.2.tar.gz";
|
||||
hash = "sha256-UymxU4MiHWuEkpgjMmkRujS+SQC3+YOa4Bs0LGAjp/E=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "N-V-__8AAP4lXQKz3tL4vtQfkU_xbsKoxat8ehi0lpR9s7-3";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/KhronosGroup/glslang/archive/7200bc12a8979d13b22cd52de80ffb7d41939615.tar.gz";
|
||||
hash = "sha256-HkVRuxxxM7NVUnCj3I0uvj0pHaE6TVnOtX/+3gSU/08=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "glslang-1.4.309-eMn68Pu-CQBK98WlBPbet0hMUVM2hNWdVP4mKn1hNsD-";
|
||||
path = fetchzip {
|
||||
url = "https://github.com/Games-by-Mason/glslang-zig/archive/4d2877072dc0ebb97698e6620a59e55ef3f367ce.tar.gz";
|
||||
hash = "sha256-0Jt+IExSP93qzbl0Q+nxhXoUz1n6lTkk2dEW2s+yeRs=";
|
||||
};
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user