nixpkgs/pkgs/tools/misc/xprite-editor/default.nix
aleksana 1862813d11 treewide: convert cargoSha256 to cargoHash
This is done with the following bash script:

```
#!/usr/bin/env bash
process_line() {
    local filename=${1%:}
    if [[ $4 =~ \"(.*)\"\; ]]; then
      local sha256="${BASH_REMATCH[1]}"
    fi
    [[ -z $sha256 ]] && return 0
    local hash=$(nix hash to-sri --type sha256 $sha256)
    echo "Processing: $filename"
    echo "  $sha256 => $hash"
    sed -i "s|cargoSha256 = \"$sha256\"|cargoHash = \"$hash\"|"
$filename
}

# split output by line
grep -r 'cargoSha256 = ' . | while IFS= read -r line; do
    # split them further by space
    read -r -a parts <<< "$line"
    process_line "${parts[@]}"
done

```
2024-07-03 21:54:10 +08:00

48 lines
1.3 KiB
Nix

{ lib, stdenv
, fetchFromGitHub
, rustPlatform
, gtk3
, AppKit
, pkg-config
, python3
}:
rustPlatform.buildRustPackage rec {
pname = "xprite-editor-unstable";
version = "2019-09-22";
src = fetchFromGitHub {
owner = "rickyhan";
repo = "xprite-editor";
rev = "7f899dff982642927024540e4bafd74e4ea5e52a";
sha256 = "1k6k8y8gg1vdmyjz27q689q9rliw0rrnzwlpjcd4vlc6swaq9ahx";
fetchSubmodules = true;
# Rename unicode file name which leads to different checksums on HFS+
# vs. other filesystems because of unicode normalization.
postFetch = ''
mv $out/config/palettes/Sweet\ Guaran*.hex $out/config/palettes/Sweet\ Guarana.hex
'';
};
buildInputs = lib.optionals stdenv.isLinux [ gtk3 ]
++ lib.optionals stdenv.isDarwin [ AppKit ];
nativeBuildInputs = lib.optionals stdenv.isLinux [ pkg-config python3 ];
cargoHash = "sha256-k53nSYBIJJHPivz6IvF5t0eZVkTvj1ZT3RyHdoy5MXw=";
cargoBuildFlags = [ "--bin" "xprite-native" ];
meta = with lib; {
# error[E0034]: multiple applicable items in scope
# multiple `clamp` found
# https://github.com/NixOS/nixpkgs/issues/146949
broken = true;
homepage = "https://github.com/rickyhan/xprite-editor";
description = "Pixel art editor";
license = licenses.gpl3;
maintainers = [ ];
platforms = platforms.linux ++ platforms.darwin;
};
}