2024-01-07 17:32:49 +03:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils, ... }:
|
|
|
|
let
|
|
|
|
inherit (builtins) substring;
|
|
|
|
version = "${substring 0 8 self.lastModifiedDate}_${self.shortRev or "dirty"}";
|
|
|
|
|
|
|
|
mkGodotEmailTemplates = { stdenv, fetchurl, unzip, lib, ... }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "godot-email-templates";
|
|
|
|
version = "4.2.1-stable";
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/godotengine/godot/releases/download/${version}/Godot_v${version}_export_templates.tpz";
|
|
|
|
hash = "sha256-xfFA61eEY6L6FAfzXjfBeqNKS4R7nTDinDhHuV5t2gc=";
|
|
|
|
};
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
unpackPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
unzip $src
|
|
|
|
mv templates $out/${lib.replaceStrings ["-"] ["."] version}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
mkMindustryTools =
|
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, vulkan-loader
|
|
|
|
, libGL
|
|
|
|
, libX11
|
|
|
|
, libXcursor
|
|
|
|
, libXinerama
|
|
|
|
, libXext
|
|
|
|
, libXrandr
|
|
|
|
, libXrender
|
|
|
|
, libXi
|
|
|
|
, libXfixes
|
|
|
|
, libxkbcommon
|
|
|
|
, alsa-lib
|
|
|
|
, libpulseaudio
|
|
|
|
, dbus
|
|
|
|
, speechd
|
|
|
|
, fontconfig
|
|
|
|
, udev
|
|
|
|
, makeWrapper
|
|
|
|
, autoPatchelfHook
|
|
|
|
, godot_4
|
|
|
|
, godotEmailTemplates
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "mindustry-tools";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
makeWrapper
|
|
|
|
godot_4
|
|
|
|
];
|
|
|
|
|
|
|
|
runtimeDependencies = [
|
|
|
|
vulkan-loader
|
|
|
|
libGL
|
|
|
|
libX11
|
|
|
|
libXcursor
|
|
|
|
libXinerama
|
|
|
|
libXext
|
|
|
|
libXrandr
|
|
|
|
libXrender
|
|
|
|
libXi
|
|
|
|
libXfixes
|
|
|
|
libxkbcommon
|
|
|
|
alsa-lib
|
|
|
|
libpulseaudio
|
|
|
|
dbus
|
|
|
|
dbus.lib
|
|
|
|
speechd
|
|
|
|
fontconfig
|
|
|
|
fontconfig.lib
|
|
|
|
udev
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$(pwd)
|
|
|
|
mkdir -p .local/share/godot/export_templates/
|
|
|
|
cp -r ${godotEmailTemplates}/* .local/share/godot/export_templates
|
2024-01-08 01:07:56 +03:00
|
|
|
# godot4 --headless --export-release "Linux/X11" mindustry-tools
|
|
|
|
godot4 --headless --export-debug "Linux/X11" mindustry-tools
|
2024-01-07 17:32:49 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -m755 -D mindustry-tools $out/bin/mindustry-tools
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
inherit (builtins) mapAttrs;
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
|
|
|
|
godotEmailTemplates = pkgs.callPackage mkGodotEmailTemplates { };
|
|
|
|
mindustryTools = pkgs.callPackage mkMindustryTools { inherit godotEmailTemplates; };
|
|
|
|
|
|
|
|
mkApp = drv: flake-utils.lib.mkApp { inherit drv; };
|
|
|
|
packages = {
|
|
|
|
default = mindustryTools;
|
|
|
|
email-templates = godotEmailTemplates;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
check = packages;
|
|
|
|
|
|
|
|
inherit packages;
|
|
|
|
|
|
|
|
apps = mapAttrs (name: mkApp) packages;
|
|
|
|
});
|
|
|
|
}
|