mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 19:21:04 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
85 lines
2.1 KiB
Nix
85 lines
2.1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, copyDesktopItems
|
|
, makeDesktopItem
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, cmake
|
|
, python3
|
|
, qtbase
|
|
, qttools
|
|
, qtwayland
|
|
, imagemagick
|
|
, wrapQtAppsHook
|
|
, gitUpdater
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "pokefinder";
|
|
version = "4.2.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "Admiral-Fish";
|
|
repo = "PokeFinder";
|
|
rev = "v${version}";
|
|
sha256 = "R0FrRRQRe0tWrHUoU4PPwOgIsltUEImEMTXL79ISfRE=";
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
patches = [
|
|
./set-desktop-file-name.patch
|
|
# fix compatibility with our libstdc++
|
|
# https://github.com/Admiral-Fish/PokeFinder/pull/392
|
|
(fetchpatch {
|
|
url = "https://github.com/Admiral-Fish/PokeFinder/commit/2cb1b049cabdf0d1b32c8cf29bf6c9d9c5c55cb0.patch";
|
|
hash = "sha256-F/w7ydsZ5tZParMWi33W3Tv8A6LLiJt4dAoCrs40DIo=";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
patchShebangs Source/Core/Resources/
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
'' + lib.optionalString (stdenv.hostPlatform.isDarwin) ''
|
|
mkdir -p $out/Applications
|
|
cp -R Source/PokeFinder.app $out/Applications
|
|
'' + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
install -D Source/PokeFinder $out/bin/PokeFinder
|
|
mkdir -p $out/share/pixmaps
|
|
convert "$src/Source/Form/Images/pokefinder.ico[-1]" $out/share/pixmaps/pokefinder.png
|
|
'' + ''
|
|
runHook postInstall
|
|
'';
|
|
|
|
nativeBuildInputs = [ cmake wrapQtAppsHook python3 ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ copyDesktopItems imagemagick ];
|
|
|
|
desktopItems = [
|
|
(makeDesktopItem {
|
|
name = "pokefinder";
|
|
exec = "PokeFinder";
|
|
icon = "pokefinder";
|
|
comment = "Cross platform Pokémon RNG tool";
|
|
desktopName = "PokéFinder";
|
|
categories = [ "Utility" ];
|
|
})
|
|
];
|
|
|
|
buildInputs = [ qtbase qttools ]
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ];
|
|
|
|
passthru.updateScript = gitUpdater {
|
|
rev-prefix = "v";
|
|
};
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/Admiral-Fish/PokeFinder";
|
|
description = "Cross platform Pokémon RNG tool";
|
|
mainProgram = "PokeFinder";
|
|
license = licenses.gpl3Only;
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ leo60228 ];
|
|
};
|
|
}
|