about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/godot/3/mono/default.nix
blob: 22e95fb0e51ad327e74507561e4a9ac4f19aa017 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ godot3
, callPackage
, mkNugetDeps
, mkNugetSource
, mono
, dotnet-sdk
, writeText
}:

godot3.overrideAttrs (self: base: {
  pname = "godot3-mono";

  godotBuildDescription = "mono build";

  nativeBuildInputs = base.nativeBuildInputs ++ [ mono dotnet-sdk ];

  glue = callPackage ./glue.nix {};

  nugetDeps = mkNugetDeps { name = "deps"; nugetDeps = import ./deps.nix; };

  nugetSource =
    mkNugetSource {
      name = "${self.pname}-nuget-source";
      description = "A Nuget source with dependencies for ${self.pname}";
      deps = [ self.nugetDeps ];
    };

  nugetConfig = writeText "NuGet.Config" ''
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <add key="${self.pname}-deps" value="${self.nugetSource}/lib" />
      </packageSources>
    </configuration>
  '';

  sconsFlags = base.sconsFlags ++ [
    "module_mono_enabled=true"
    "mono_prefix=${mono}"
  ];

  shouldConfigureNuget = true;

  postConfigure = ''
    echo "Setting up buildhome."
    mkdir buildhome
    export HOME="$PWD"/buildhome

    echo "Overlaying godot glue."
    cp -R --no-preserve=mode "$glue"/. .

    if [ -n "$shouldConfigureNuget" ]; then
      echo "Configuring NuGet."
      mkdir -p ~/.nuget/NuGet
      ln -s "$nugetConfig" ~/.nuget/NuGet/NuGet.Config
    fi
  '';

  installedGodotShortcutFileName = "org.godotengine.GodotMono3.desktop";
  installedGodotShortcutDisplayName = "Godot Engine (Mono) 3";

  passthru = {
    make-deps = callPackage ./make-deps.nix {};
  };
})