1

i'm on nixos 20.09 and try to build godot-3.2.3-stable with support for C#.

I'm following the instruction on the godot docs, which states that one first has to enable the mono module and then generate the mono-glue. I tried to adapt the default.nix of the NixOS/nixpkgs repository to my needs but failed.

What i tried is to first generate the glue like mentioned in the godot docs and then compile with C# support.

with import <nixpkgs> {};

let options = {
  pulseaudio = true;
};`

in 
stdenv.mkDerivation rec {
  name = "tools_";
  version = "3.2.3";

  src = ./godot-3.2.3-stable.tar.gz;

  nativeBuildInputs = with pkgs; [ pkg-config ];
  buildInputs = with pkgs; [ scons mono6 msbuild dotnetPackages.Nuget xorg.libX11 xorg.libXcursor
                             xorg.libXinerama xorg.libXrandr xorg.libXrender xorg.libXi xorg.libXext 
                             xorg.libXfixes freetype openssl alsaLib libpulseaudio libGLU zlib yasm
                            ];

  patches = [
    ./pkg_config_additions.patch
    ./dont_clobber_environment.patch
  ];

  enableParallelBuilding = true;

  sconsFlags = "target=release_debug platform=x11 tools=yes module_mono_enabled=yes mono_glue=no";
  preConfigure = ''
    sconsFlags+=" ${lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)}"
  '';

  outputs = [ "out" ];

  installPhase = ''
    mkdir -p "$out/bin"
    cp bin/godot.* $out/bin/godot
  '';

}

But if i run this with nix-build i get the error:

Checking for `thread_local` support... supported
Mono root directory not found. Using pkg-config instead
/nix/store/vnyfysaya7sblgdyvqjkrjbrb0cy11jf-bash-4.4-p23/bin/sh: pkg-config: command not found
OSError: 'pkg-config monosgen-2 --libs-only-L' exited 127:
  File "/build/godot-3.2.3-stable/SConstruct", line 617:
    SConscript("modules/SCsub")
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 661:
    return method(*args, **kw)
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/build/godot-3.2.3-stable/modules/SCsub", line 21:
    SConscript(name + "/SCsub")  # Built-in.
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 661:
    return method(*args, **kw)
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/build/godot-3.2.3-stable/modules/mono/SCsub", line 34:
    mono_configure.configure(env, env_mono)
  File "/build/godot-3.2.3-stable/modules/mono/build_scripts/mono_configure.py", line 351:
    tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L")
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Environment.py", line 1612:
    return function(self, self.backtick(command))
  File "/nix/store/ypb1lsl610mw3s76p232hjmnhwakjb06-scons-4.0.1/lib/python3.8/site-packages/SCons/Environment.py", line 599:
    raise OSError("'%s' exited %d" % (command, status))
builder for '/nix/store/acpp99hr7q92a7j1bk2nga00n4v8za7z-tools_.drv' failed with exit code 2
error: build of '/nix/store/acpp99hr7q92a7j1bk2nga00n4v8za7z-tools_.drv' failed

I'm sorry but i'm totally lost there, since this is my first derivation i am trying to build. I have already searched the nixpkgs manual but couldn't solve my problem. Probably due to the fact that i'm not exactly sure what i am looking for. Also i was asking myself if this is going to work anyways since the godot docs state that after generating the glue one has to:

### Build binaries normally
# Editor
scons p=x11 target=release_debug tools=yes module_mono_enabled=yes

and i don't know if i could then simply rerun the above mentioned derivation with the appropriate sconsFlags or if and how i could simply write one file which does the same job done.

If someone could help me and point me in the right direction so that i at least would know what i exactly have to search for i would very much appreciate it. Thanks in advance.

leunam
  • 11
  • 1
  • Dotnet is kind of a pain point in nixpkgs currently. The infrastructure is less than ideal atm. You could try https://github.com/baracoder/dotnet2nix, but it may not be far enough along to help. – nrdxp Feb 23 '21 at 04:24
  • @nrdxp thanks a lot for your suggestion this seems like it could work as well. Nevertheless I found a solution to my problem in the meantime on https://github.com/sgillespie/nixos-godot which i could tweak to my needs. – leunam Feb 25 '21 at 21:23

0 Answers0