-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
938f98a
commit 65c57ae
Showing
11 changed files
with
1,340 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This modules create a Godot project derivation. | ||
{ | ||
lib, | ||
stdenv, | ||
buildEnv, | ||
makeWrapper, | ||
godot, | ||
exportTemplates, # absolute path to the nix store | ||
}: { | ||
pname, | ||
version, | ||
src, | ||
preset, | ||
addons ? [], | ||
preBuildPhase ? "", | ||
preInstallPhase ? "", | ||
|
||
}: let | ||
addonsEnv = buildEnv { | ||
name = "addons"; | ||
paths = addons; | ||
}; | ||
|
||
godotVersionFfolder = lib.replaceStrings ["-"] ["."] godot.version; | ||
in | ||
stdenv.mkDerivation rec { | ||
inherit pname version src; | ||
|
||
nativeBuildInputs = addons; | ||
buildInputs = [godot makeWrapper]; | ||
|
||
postPatch = '' | ||
patchShebangs scripts | ||
''; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
${preBuildPhase} | ||
export HOME=$(mktemp -d) | ||
# Remove custom_template path if it doesn't point to the nix store | ||
sed -i -e '/custom_template/!b' -e '/\/nix\/store/b' -e 's/"[^"]*"/""/g' -e 't' export_presets.cfg | ||
mkdir -p $HOME/.local/share/godot/export_templates | ||
ln -s ${exportTemplates} $HOME/.local/share/godot/export_templates/${godotVersionFfolder} | ||
cp -r ${addonsEnv}/* ./addons | ||
godot --headless --import | ||
mkdir -p ./build | ||
godot --headless --export-release "${preset}" ./build/${pname}.x86_64 | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
${preInstallPhase} | ||
install -D -m 755 -t $out/share/${pname} ./build/${pname}.x86_64 | ||
install -D -m 644 -t $out/share/${pname} ./build/${pname}.pck | ||
install -d -m 755 $out/bin | ||
makeWrapper $out/share/${pname}/${pname}.x86_64 $out/bin/${pname} \ | ||
--add-flags "--main-pack" \ | ||
--add-flags "$out/share/${pname}/${pname}.pck" | ||
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 $out/share/${pname}/${pname}.x86_64 | ||
runHook postInstall | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# This modules patch a given Godot project derivation, to make it runnable on Nixos. | ||
{ | ||
stdenv, | ||
copyDesktopItems, | ||
installShellFiles, | ||
autoPatchelfHook, | ||
xorg, | ||
vulkan-loader, | ||
libGL, | ||
libxkbcommon, | ||
alsa-lib, | ||
}: { | ||
pname, | ||
version, | ||
src, | ||
}: | ||
stdenv.mkDerivation rec { | ||
inherit pname version src; | ||
|
||
nativeBuildInputs = [ | ||
autoPatchelfHook | ||
installShellFiles | ||
copyDesktopItems | ||
]; | ||
|
||
runtimeDependencies = [ | ||
vulkan-loader | ||
libGL | ||
xorg.libX11 | ||
xorg.libXcursor | ||
xorg.libXinerama | ||
xorg.libXext | ||
xorg.libXrandr | ||
xorg.libXrender | ||
xorg.libXi | ||
xorg.libXfixes | ||
libxkbcommon | ||
alsa-lib | ||
]; | ||
|
||
postPatch = '' | ||
patchShebangs scripts | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir $out | ||
mv bin/* bin/${pname} || true # Rename fails if pname is the same | ||
cp -r * $out | ||
runHook postInstall | ||
''; | ||
} |
Oops, something went wrong.