Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 89 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 godot_4_4, 6 nix-update-script, 7}: 8 9let 10 presets = { 11 "i686-linux" = "Linux 32-bit"; 12 "x86_64-linux" = "Linux 64-bit"; 13 "aarch64-linux" = "Linux ARM64"; 14 }; 15 preset = 16 presets.${stdenv.hostPlatform.system} 17 or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 18 19 godot = godot_4_4; 20in 21stdenv.mkDerivation (finalAttrs: { 22 pname = "pixelorama"; 23 version = "1.1.1"; 24 25 src = fetchFromGitHub { 26 owner = "Orama-Interactive"; 27 repo = "Pixelorama"; 28 rev = "v${finalAttrs.version}"; 29 hash = "sha256-HXCfZ/ePqEMnaEN+fxGVoaFWsO1isTAyYoRpLY6opRg="; 30 }; 31 32 strictDeps = true; 33 34 nativeBuildInputs = [ 35 godot 36 ]; 37 38 # Pixelorama is tightly coupled to the version of Godot that it is meant to be built with, 39 # and Godot does not follow semver, they break things in minor releases. 40 preConfigure = '' 41 godot_ver="${lib.versions.majorMinor godot.version}" 42 godot_expected=$(sed -n -E 's@config/features=PackedStringArray\("([0-9]+\.[0-9]+)"\)@\1@p' project.godot) 43 [ "$godot_ver" == "$godot_expected" ] || { 44 echo "Expected Godot version: $godot_expected; found: $godot_ver" >&2 45 exit 1 46 } 47 ''; 48 49 buildPhase = '' 50 runHook preBuild 51 52 export HOME=$(mktemp -d) 53 mkdir -p $HOME/.local/share/godot/ 54 ln -s "${godot.export-template}"/share/godot/export_templates "$HOME"/.local/share/godot/ 55 mkdir -p build 56 godot4 --headless --export-release "${preset}" ./build/pixelorama 57 58 runHook postBuild 59 ''; 60 61 installPhase = '' 62 runHook preInstall 63 64 install -D -m 755 -t $out/libexec ./build/pixelorama 65 install -D -m 644 -t $out/libexec ./build/pixelorama.pck 66 install -D -m 644 -t $out/share/applications ./Misc/Linux/com.orama_interactive.Pixelorama.desktop 67 install -D -m 644 -T ./assets/graphics/icons/icon.png $out/share/icons/hicolor/256x256/apps/pixelorama.png 68 install -d -m 755 $out/bin 69 ln -s $out/libexec/pixelorama $out/bin/pixelorama 70 71 runHook postInstall 72 ''; 73 74 passthru.updateScript = nix-update-script { }; 75 76 meta = with lib; { 77 homepage = "https://orama-interactive.itch.io/pixelorama"; 78 description = "Free & open-source 2D sprite editor, made with the Godot Engine"; 79 changelog = "https://github.com/Orama-Interactive/Pixelorama/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 80 license = licenses.mit; 81 platforms = [ 82 "i686-linux" 83 "x86_64-linux" 84 "aarch64-linux" 85 ]; 86 maintainers = with maintainers; [ felschr ]; 87 mainProgram = "pixelorama"; 88 }; 89})