Unverified Commit eeea02df authored by David McFarland's avatar David McFarland Committed by GitHub
Browse files

godot_4{_3,_4}{,-mono}: add source build of export template (#400897)

parents 08ed87cc 1a8f4e47
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -424,6 +424,8 @@
- [`lib.packagesFromDirectoryRecursive`] now rejects unknown arguments.
  [`lib.packagesFromDirectoryRecursive`]: https://nixos.org/manual/nixpkgs/stable/#function-library-lib.filesystem.packagesFromDirectoryRecursive

- The `godot-export-templates` package now has its content at `share/godot/export_templates/$version` instead of the output root. This makes it more convenient for for symlinking into `~/.local`, but scripts expecting the old layout will need to be changed.

### Deprecations {#sec-nixpkgs-release-25.05-lib-deprecations}

- `functor` is an implementation detail and should not be relied upon, but since its status wasn't clear and it has had some use cases without alternatives, changes are being handled as gracefully as possible. Deprecations within functor:
+19 −31
Original line number Diff line number Diff line
{
  alsa-lib,
  autoPatchelfHook,
  cargo,
  dbus,
  fetchFromGitHub,
@@ -43,34 +42,12 @@ stdenv.mkDerivation (finalAttrs: {
  cargoRoot = "extensions";

  nativeBuildInputs = [
    autoPatchelfHook
    cargo
    godot_4_4
    godot_4_4.export-templates-bin
    pkg-config
    rustPlatform.cargoSetupHook
  ];

  runtimeDependencies = [
    alsa-lib
    dbus
    gamescope
    hwdata
    libGL
    libpulseaudio
    mesa-demos
    udev
    upower
    vulkan-loader
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXi
    xorg.libXrandr
    xorg.libXres
    xorg.libXtst
  ];

  dontStrip = withDebug;

  env =
@@ -81,7 +58,7 @@ stdenv.mkDerivation (finalAttrs: {
      GODOT = lib.getExe godot_4_4;
      GODOT_VERSION = lib.elemAt versionAndRelease 0;
      GODOT_RELEASE = lib.elemAt versionAndRelease 1;
      EXPORT_TEMPLATE = "${godot_4_4.export-templates-bin}";
      EXPORT_TEMPLATE = "${godot_4_4.export-template}/share/godot/export_templates";
      BUILD_TYPE = "${finalAttrs.buildType}";
    };

@@ -92,14 +69,25 @@ stdenv.mkDerivation (finalAttrs: {
  preBuild = ''
    # Godot looks for export templates in HOME
    export HOME=$(mktemp -d)
    mkdir -p $HOME/.local/share/godot/export_templates
    ln -s "${godot_4_4.export-templates-bin}" "$HOME/.local/share/godot/export_templates/$GODOT_VERSION.$GODOT_RELEASE"
    mkdir -p $HOME/.local/share/godot/
    ln -s "$EXPORT_TEMPLATE" "$HOME"/.local/share/godot/
  '';

  postInstall = ''
  postInstall =
    let
      runtimeDependencies = [
        gamescope
        hwdata
        mesa-demos
        udev
        upower
      ];
    in
    ''
      # The Godot binary looks in "../lib" for gdextensions
      mkdir -p $out/share/lib
      mv $out/share/opengamepadui/*.so $out/share/lib
      patchelf --add-rpath ${lib.makeLibraryPath runtimeDependencies} $out/share/lib/*.so
    '';

  passthru.updateScript = nix-update-script { };
+2 −28
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  alsa-lib,
  autoPatchelfHook,
  fetchFromGitHub,
  godot_4_3,
  libGL,
  libpulseaudio,
  libX11,
  libXcursor,
  libXext,
  libXi,
  libXrandr,
  nix-update-script,
  udev,
  vulkan-loader,
}:

let
@@ -28,7 +17,6 @@ let
      or (throw "Unsupported system: ${stdenv.hostPlatform.system}");

  godot = godot_4_3;
  godot_version_folder = lib.replaceStrings [ "-" ] [ "." ] godot.version;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "pixelorama";
@@ -44,29 +32,15 @@ stdenv.mkDerivation (finalAttrs: {
  strictDeps = true;

  nativeBuildInputs = [
    autoPatchelfHook
    godot
  ];

  runtimeDependencies = map lib.getLib [
    alsa-lib
    libGL
    libpulseaudio
    libX11
    libXcursor
    libXext
    libXi
    libXrandr
    udev
    vulkan-loader
  ];

  buildPhase = ''
    runHook preBuild

    export HOME=$(mktemp -d)
    mkdir -p $HOME/.local/share/godot/export_templates
    ln -s "${godot.export-templates-bin}" "$HOME/.local/share/godot/export_templates/${godot_version_folder}"
    mkdir -p $HOME/.local/share/godot/
    ln -s "${godot.export-template}"/share/godot/export_templates "$HOME"/.local/share/godot/
    mkdir -p build
    godot4 --headless --export-release "${preset}" ./build/pixelorama

+7 −2
Original line number Diff line number Diff line
{
  version = "4.3-stable";
  hash = "sha256-MzElflwXHWLgPtoOIhPLA00xX8eEdQsexZaGIEOzbj0=";
  exportTemplatesHash = "sha256-XRnKii+eexIkbGf7bqc42SR0NBULFvgMdOpSRNNk6kg=";
  default = {
    exportTemplatesHash = "sha256-9fENuvVqeQg0nmS5TqjCyTwswR+xAUyVZbaKK7Q3uSI=";
  };
  mono = {
    exportTemplatesHash = "sha256-pkDZfkJHiDtY05TGERwTNDES88SbuFfZVYb5hln6O+U=";
    nugetDeps = ./deps.json;
  };
}
+7 −2
Original line number Diff line number Diff line
{
  version = "4.4.1-stable";
  hash = "sha256-O4TdPYu1K2zWKMBP/7xd0UPLDb7/4dBnkGM7QydD3Yo=";
  exportTemplatesHash = "sha256-KV4sDBZPiMf7IORaNFR2uEK1midnyyjCUfG9hl6AwHY=";
  default = {
    exportTemplatesHash = "sha256-eo0UreSJ/U0i8XgZMCH+iodqnlEGjtTd4m2sOuTFmog=";
  };
  mono = {
    exportTemplatesHash = "sha256-tk0WS5axndcXWhuj86blg+nU3FB7PRMzVj8ka1gRgj4=";
    nugetDeps = ./deps.json;
  };
}
Loading