Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

godot: add mono support #88006

Closed
wants to merge 1 commit into from
Closed

godot: add mono support #88006

wants to merge 1 commit into from

Conversation

lihop
Copy link
Member

@lihop lihop commented May 17, 2020

Following the guide https://docs.godotengine.org/en/3.2/development/compiling/compiling_with_mono.html

Motivation for this change

The Godot game engine supports scripting with the C# programming language. However, in order to so it must be compiled with mono support. This pull request adds such an option to the Nixpkgs derivation.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

pkgs/development/tools/godot/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/godot/default.nix Outdated Show resolved Hide resolved
pkgs/development/tools/godot/mono-deps.nix Outdated Show resolved Hide resolved
@SuperSandro2000
Copy link
Member

Result of nixpkgs-review pr 88006 run on x86_64-linux 1

3 packages built:
  • godot
  • godot-headless
  • godot-server

@ofborg ofborg bot requested a review from yusdacra January 6, 2021 15:16
@lihop
Copy link
Member Author

lihop commented Jan 6, 2021

Under 'Editor -> Editor Settings... -> Mono -> Builds' there are two options for building Godot mono projects:

  1. dotnet CLI (default)
  2. msbuild

This package currently works with 'msbuild' but I haven't been able to get it to work with 'dotnet CLI'.

When I manually build from source in a pure nix shell (nix-shell -E '(import <nixpkgs>{}).godot.override { withMono = true; }' --pure) I can get both to work, but when building with nix-build or nixos-rebuild I get the following error:

MSBUILD : error MSB1021: Cannot create an instance of the logger. Bad IL format.
Switch: GodotTools.BuildLogger.GodotBuildLogger,/nix/store/bryyihwav4xpjh9pfrr3wi4h0cwfcm28-godot-3.2.3/bin/GodotSharp/Tools/GodotTools.BuildLogger.dll;/home/leroy/.local/share/godot/mono/build_logs/ec2dfe320f37ca72e3b227f70b743849_Debug

I noticed some differences between the dll produced in the with nix-build and manually under nix-shell:
nix-build:

File Name                       : GodotTools.BuildLogger.dll
Directory                       : /nix/store/79wqr0kcka5d7y7mbbb2ga3h83xzjc7s-godot-3.2.3/bin/GodotSharp/Tools
File Permissions                : r--r--r--
Image File Characteristics      : Executable, No line numbers, No symbols, Large address aware, 32-bit, No debug, DLL
Linker Version                  : 2.31

nix-shell:

File Name                       : GodotTools.BuildLogger.dll
Directory                       : bin/GodotSharp/Tools
File Permissions                : rw-r--r--
Image File Characteristics      : Executable, Large address aware, DLL
Linker Version                  : 48.0

So, I am still working on this one.

@ofborg ofborg bot requested a review from yusdacra January 6, 2021 16:15
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
# Script to generate the mono-deps.nix file.
set -e

# Check for dotnet2nix.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this can we enter a shell with dotnet2nix, so that the user doesn't need to install it manually?

@ofborg ofborg bot requested a review from yusdacra January 6, 2021 16:30
monoGlueGenerator = godot.overrideAttrs (oldAttrs: rec {
sconsFlags = "target=release_debug platform=server tools=yes module_mono_enabled=yes mono_glue=no mono_static=yes mono_prefix=${mono}";
outputs = [ "out" ];
installPhase = "mkdir -p $out/bin && cp bin/* $out/bin";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
installPhase = "mkdir -p $out/bin && cp bin/* $out/bin";
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin
'';

${monoGlueGenerator}/bin/godot_server.x11.opt.tools.*.mono --generate-mono-glue modules/mono/glue

# Set a fake HOME for NuGet otherwise it gets denied permission trying to access "/homeless-shelter".
export HOME=$(pwd)/fake-home
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export HOME=$(pwd)/fake-home
export HOME=$TMP

#! /usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils dotnet-sdk nix jq
# Script to generate the mono-deps.nix file.
set -e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
set -e
set -eo pipefail

{ fetchurl }:
[
EOF
for package in `jq -r '.[] | @base64' nugets.json`; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for package in `jq -r '.[] | @base64' nugets.json`; do
for package in $(jq -r '.[] | @base64' nugets.json); do

@stale
Copy link

stale bot commented Jul 8, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 8, 2021
@lihop
Copy link
Member Author

lihop commented Aug 6, 2022

Closed in favor of #177578.

@lihop lihop closed this Aug 6, 2022
@lihop lihop deleted the godot-mono branch August 6, 2022 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 10.rebuild-darwin: 0 10.rebuild-linux: 1-10 11.by: package-maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants