84 lines
2.8 KiB
Nix
84 lines
2.8 KiB
Nix
# Copyright 2025 DigitalDragon <digitaldragon.club>
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
{
|
|
description = "ArmorPaint flake";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
armortools = {
|
|
url = "github:armory3d/armortools";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, armortools }: {
|
|
|
|
packages.x86_64-linux.armorpaint =
|
|
with import nixpkgs { system = "x86_64-linux"; };
|
|
stdenv.mkDerivation rec {
|
|
name = "ArmorPaint";
|
|
src = armortools;
|
|
patches = [ ./shebang+platform-fix.patch ];
|
|
buildInputs = [
|
|
# Required programs
|
|
steam-run-free
|
|
clang
|
|
];
|
|
nativeBuildInputs = [
|
|
# Main ArmorPaint dependencies
|
|
xorg.libXinerama
|
|
xorg.libXrandr
|
|
alsa-lib
|
|
xorg.libXi
|
|
mesa
|
|
libGL
|
|
xorg.libXcursor
|
|
udev
|
|
gtk3
|
|
# Additional dependencies
|
|
glib
|
|
pango
|
|
harfbuzz
|
|
cairo
|
|
gdk-pixbuf
|
|
atk
|
|
libxkbcommon
|
|
];
|
|
buildPhase = ''
|
|
cd armorpaint
|
|
export CPATH="${gtk3.dev}/include/gtk-3.0:${glib.dev}/include/glib-2.0:${pango.dev}/include/pango-1.0:${harfbuzz.dev}/include/harfbuzz:${cairo.dev}/include/cairo:${gdk-pixbuf.dev}/include/gdk-pixbuf-2.0:${atk.dev}/include/atk-1.0:${libxkbcommon.dev}/include:$CPATH"
|
|
export KINC_PLATFORM=linux_x64
|
|
steam-run ../armorcore/make --graphics opengl --run
|
|
'';
|
|
installPhase = ''
|
|
mkdir $out/bin -p
|
|
mv ./build/out $out/lib
|
|
{ echo "#!${bash}/bin/bash -e"; \
|
|
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${lib.makeLibraryPath nativeBuildInputs}"; \
|
|
echo "export GSETTINGS_SCHEMA_DIR=${gtk3}/share/gsettings-schemas/gtk+3-${gtk3.version}/glib-2.0/schemas"; \
|
|
echo "tempdir=/tmp/armorpaint-\$USER"; \
|
|
echo "mkdir \$tempdir/data -p"; \
|
|
echo "ln -sf $out/lib/ArmorPaint \$tempdir"; \
|
|
echo "ln -sf $out/lib/data/* \$tempdir/data/"; \
|
|
echo "exec \"\$tempdir/ArmorPaint\" \"\$@\""; \
|
|
} > $out/bin/ArmorPaint
|
|
chmod +x $out/bin/ArmorPaint
|
|
'';
|
|
};
|
|
|
|
packages.x86_64-linux.default = self.packages.x86_64-linux.armorpaint;
|
|
|
|
};
|
|
}
|