Skip to content

Commit

Permalink
WIP: pkgs: Add edopro package
Browse files Browse the repository at this point in the history
  • Loading branch information
TLATER committed Jul 13, 2024
1 parent a31d748 commit 4b144b0
Show file tree
Hide file tree
Showing 5 changed files with 262 additions and 0 deletions.
63 changes: 63 additions & 0 deletions pkgs/_sources/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,69 @@
},
"version": "2.1.22-31"
},
"edopro": {
"cargoLocks": null,
"date": "2024-06-22",
"extract": null,
"name": "edopro",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": true,
"leaveDotGit": false,
"name": null,
"owner": "edo9300",
"repo": "edopro",
"rev": "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff",
"sha256": "sha256-6EEwJD5CB0IkWvz/rGAKHhkDJb0BpXG1Ejq8exIsuOg=",
"sparseCheckout": [],
"type": "github"
},
"version": "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff"
},
"edopro-distribution": {
"cargoLocks": null,
"date": "2024-06-13",
"extract": null,
"name": "edopro-distribution",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": true,
"leaveDotGit": true,
"name": null,
"owner": "ProjectIgnis",
"repo": "Distribution",
"rev": "286db345033c79cab6e36a8f06de3468008ff8cd",
"sha256": "sha256-ulolyrOw6bBySIRi1LEDwGASuUjO1OzRdmdx+VlcW+8=",
"sparseCheckout": [],
"type": "github"
},
"version": "286db345033c79cab6e36a8f06de3468008ff8cd"
},
"edopro-irrlicht": {
"cargoLocks": null,
"date": "2024-03-16",
"extract": null,
"name": "edopro-irrlicht",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "edo9300",
"repo": "irrlicht1-8-4",
"rev": "ba76104ccb104d769cdccda014e0a3966f7c40ac",
"sha256": "sha256-xVlVt9zv7SenEYhBQSop4UnNS5g4N5aPgiqSHhhajD8=",
"sparseCheckout": [],
"type": "github"
},
"version": "ba76104ccb104d769cdccda014e0a3966f7c40ac"
},
"eglot-x": {
"cargoLocks": null,
"date": "2024-07-02",
Expand Down
39 changes: 39 additions & 0 deletions pkgs/_sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,45 @@
sha256 = "sha256-2O0TjRhuwLd+QPUxV9tHeuWYtGoRnBa6icU7DMmxWyI=";
};
};
edopro = {
pname = "edopro";
version = "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff";
src = fetchFromGitHub {
owner = "edo9300";
repo = "edopro";
rev = "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff";
fetchSubmodules = true;
sha256 = "sha256-6EEwJD5CB0IkWvz/rGAKHhkDJb0BpXG1Ejq8exIsuOg=";
};
date = "2024-06-22";
};
edopro-distribution = {
pname = "edopro-distribution";
version = "286db345033c79cab6e36a8f06de3468008ff8cd";
src = fetchFromGitHub {
owner = "ProjectIgnis";
repo = "Distribution";
rev = "286db345033c79cab6e36a8f06de3468008ff8cd";
fetchSubmodules = true;
deepClone = false;
leaveDotGit = true;
sparseCheckout = [ ];
sha256 = "sha256-ocC1LdAGnKfNqsAHAEudn1XeG3WdFRHASIndrxTGq0g=";
};
date = "2024-06-13";
};
edopro-irrlicht = {
pname = "edopro-irrlicht";
version = "ba76104ccb104d769cdccda014e0a3966f7c40ac";
src = fetchFromGitHub {
owner = "edo9300";
repo = "irrlicht1-8-4";
rev = "ba76104ccb104d769cdccda014e0a3966f7c40ac";
fetchSubmodules = false;
sha256 = "sha256-xVlVt9zv7SenEYhBQSop4UnNS5g4N5aPgiqSHhhajD8=";
};
date = "2024-03-16";
};
eglot-x = {
pname = "eglot-x";
version = "14aa967a431f0b4d4f9e787c98b208e28f488c0b";
Expand Down
143 changes: 143 additions & 0 deletions pkgs/applications/edopro.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
stdenv,
sources,

# build deps
premake5,
writeShellScriptBin,

# edopro deps
bzip2,
curl,
flac,
fmt,
freetype,
irrlicht,
libevent,
libgit2,
libjpeg,
libpng,
libvorbis,
lua5_4_compat,
nlohmann_json,
noto-fonts-cjk-sans,
openal,
sqlite,

# Irrlicht deps
wayland,
libxkbcommon,
}:
let
lua = lua5_4_compat;

irrlicht-edopro = irrlicht.overrideAttrs (old: {
inherit (sources.edopro-irrlicht) pname version src;
buildInputs = old.buildInputs ++ [
wayland
libxkbcommon
];
});

ocgcore = stdenv.mkDerivation {
inherit (sources.edopro) version src;
pname = sources.edopro.pname + "-ocgcore";

nativeBuildInputs = [ premake5 ];
buildInputs = [ lua ];

enableParallelBuilding = true;
buildFlags = [ "verbose=true config=release ocgcoreshared" ];

# nixpkgs' lua is compiled as C, but lua can also be compiled as
# C++. Due to name mangling, a C-compiled lua will not be able to
# link to a C++ project without some hoops, but edopro normally
# builds it as a C++ library, so their code isn't used to this
# edge case.
#
# Hence we need to change the included headers a bit.
postPatch = ''
sed -i 's/#include <lua.h>/#include <lua.hpp>/g' ocgcore/*.*
sed -i '/#include <lualib.h>/d' ocgcore/*.*
sed -i '/#include <lauxlib.h>/d' ocgcore/*.*
'';

preBuild = ''
cd ocgcore
premake5 gmake2 --lua-path='${lua}'
cd build
'';

installPhase = ''
mkdir -p $out/lib
cp -r ../bin/release/* $out/lib/
'';
};

font = "${noto-fonts-cjk-sans}/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc";
edopro = stdenv.mkDerivation {
inherit (sources.edopro) pname version src;

nativeBuildInputs = [ premake5 ];

buildInputs = [
bzip2
curl
flac
fmt
freetype
irrlicht-edopro
libevent
libgit2
libjpeg
libpng
libvorbis
lua
nlohmann_json
openal
sqlite
];

# nixpkgs' gcc stack currently appears to not support LTO
postPatch = ''
sed -i '/LinkTimeOptimization/d' ./premake5.lua
'';

# Edopro normally builds irrlicht without a prefix in its include
# dir
NIX_CFLAGS_COMPILE = "-I ${irrlicht-edopro}/include/irrlicht/";

enableParallelBuilding = true;
buildFlags = [ "verbose=true config=release_x64 ygopro" ];

preBuild = ''
premake5 gmake2 \
--sound=sfml \
--no-joystick=true \
--os=linux \
--prebuilt-core='${ocgcore}/lib' \
--architecture=x64 \
--bundled-font='${font}' \
--lua-path='${lua}'
cd build
'';

installPhase = ''
mkdir -p $out/{lib,bin}
cp ../bin/x64/release/ygopro $out/bin/
cp ../bin/x64/release/*.a $out/lib
'';
};
in
writeShellScriptBin "EDOPro" ''
set -eu
EDOPRO_DIR="''${XDG_DATA_HOME:-~/.local/share}/edopro"
if [ ! -d "''${EDOPRO_DIR}" ]; then
mkdir -p "''${EDOPRO_DIR}"
cp -r ${sources.edopro-distribution.src}/*/ "''${EDOPRO_DIR}/"
fi
exec ${edopro}/bin/ygopro -C "''${EDOPRO_DIR}" $@
''
1 change: 1 addition & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in
# Proper packages
deepfilternet = callPackage ./applications/deepfilternet.nix { };
drivestrike = callPackage ./applications/drivestrike.nix { };
edopro = callPackage ./applications/edopro.nix { };
emacs = callPackage ./applications/emacs { };
gauth = callPackage ./applications/gauth.nix { };
gcs = callPackage ./applications/gcs.nix { };
Expand Down
16 changes: 16 additions & 0 deletions pkgs/nvfetcher.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ fetch.url = "https://app.drivestrike.com/static/yum/drivestrike.rpm"
src.git = "https://github.com/nemethf/eglot-x"
fetch.github = "nemethf/eglot-x"

[edopro]
src.git = "https://github.com/edo9300/edopro.git"
fetch.github = "edo9300/edopro"
git.fetchSubmodules = true

[edopro-distribution]
src.git = "https://github.com/ProjectIgnis/Distribution.git"
fetch.github = "ProjectIgnis/Distribution"
git.fetchSubmodules = true
git.leaveDotGit = true
# git.deepClone = true

[edopro-irrlicht]
src.git = "https://github.com/edo9300/irrlicht1-8-4.git"
fetch.github = "edo9300/irrlicht1-8-4"

[firefox-ui-fix]
src.github = "black7375/Firefox-UI-Fix"
fetch.github = "black7375/Firefox-UI-Fix"
Expand Down

0 comments on commit 4b144b0

Please sign in to comment.