Files
nixpkgs/pkgs/development/tools/godot/3/mono/make-deps.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

68 lines
2.4 KiB
Nix

{
godot3-mono,
nuget-to-json,
}:
godot3-mono.overrideAttrs (
self: base: {
pname = "godot3-mono-make-deps";
nativeBuildInputs = base.nativeBuildInputs ++ [
nuget-to-json
];
nugetDeps = null;
nugetSource = null;
nugetConfig = null;
keepNugetConfig = true;
outputs = [ "out" ];
buildPhase = " ";
installPhase = ''echo "No output intended. Run make-deps.sh instead." > $out'';
# This script is used to update the accompanying deps.json file, a JSON file listing the
# nuget packages that the godot-mono code depends on, along with their sha256 hashes. This
# file is referenced by the godot-mono derivation and needs to be updated every time the
# godot version is updated. The way it works is:
#
# 1) Creates and navigates to a temporary directory and then explicitly runs the unpack,
# patch, and configure phases from the godot-mono derivation.
# 2) Instead of building at this point, a nuget restore is performed, downloading all the
# nuget dependencies of godot-mono into a local folder.
# 3) Once these have been downloaded, the nuget-to-json tool is used to generate a JSON
# array listing the locally obtained nuget packages, along with their sha256 hashes.
# 4) This JSON array is saved as deps.json in the PWD.
#
# This process is impure, because it entails downloading files with unknown hashes, so it
# is run manually by the maintainer within a nix-shell environment. Running the accompanying
# make-deps.sh instead simplifies this.
makeDeps = ''
set -e
outdir="$(pwd)"
wrkdir="$(mktemp -d)"
trap 'rm -rf -- "$wrkdir"' EXIT
pushd "$wrkdir" > /dev/null
unpackPhase
cd source
patchPhase
configurePhase
# Without RestorePackagesPath set, it restores packages to a temp directory. Specifying
# a path ensures we have a place to run nuget-to-json.
nugetRestore() { dotnet msbuild -t:Restore -p:RestorePackagesPath=nugetPackages $1; }
nugetRestore modules/mono/glue/GodotSharp/GodotSharp.sln
nugetRestore modules/mono/editor/GodotTools/GodotTools.sln
nuget-to-json nugetPackages > "$outdir"/deps.json
popd > /dev/null
'';
meta = base.meta // {
description = "Derivation with no output that exists to provide an environment for make-deps.sh";
};
}
)