mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +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" ```
74 lines
1.7 KiB
Nix
74 lines
1.7 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchurl
|
|
, copyDesktopItems
|
|
, makeDesktopItem
|
|
, makeWrapper
|
|
, jre
|
|
, libGL
|
|
, libpulseaudio
|
|
, libXxf86vm
|
|
}:
|
|
let
|
|
version = "4.13.2-redo";
|
|
|
|
desktopItem = makeDesktopItem {
|
|
name = "unciv";
|
|
exec = "unciv";
|
|
comment = "An open-source Android/Desktop remake of Civ V";
|
|
desktopName = "Unciv";
|
|
icon = "unciv";
|
|
categories = [ "Game" ];
|
|
};
|
|
|
|
desktopIcon = fetchurl {
|
|
url = "https://github.com/yairm210/Unciv/blob/${version}/extraImages/Icons/Unciv%20icon%20v6.png?raw=true";
|
|
hash = "sha256-Zuz+HGfxjGviGBKTiHdIFXF8UMRLEIfM8f+LIB/xonk=";
|
|
};
|
|
|
|
envLibPath = lib.makeLibraryPath (lib.optionals stdenv.hostPlatform.isLinux [
|
|
libGL
|
|
libpulseaudio
|
|
libXxf86vm
|
|
]);
|
|
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "unciv";
|
|
inherit version;
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/yairm210/Unciv/releases/download/${version}/Unciv.jar";
|
|
hash = "sha256-bZXBgSjmW+fBdDfG7cqKkF4VLYw7Iq2mw5j6iDh2ZhY=";
|
|
};
|
|
|
|
dontUnpack = true;
|
|
|
|
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
makeWrapper ${jre}/bin/java $out/bin/unciv \
|
|
--prefix LD_LIBRARY_PATH : "${envLibPath}" \
|
|
--prefix PATH : ${lib.makeBinPath [ jre ]} \
|
|
--add-flags "-jar ${src}"
|
|
|
|
install -Dm444 ${desktopIcon} $out/share/icons/hicolor/512x512/apps/unciv.png
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
desktopItems = [ desktopItem ];
|
|
|
|
meta = with lib; {
|
|
description = "Open-source Android/Desktop remake of Civ V";
|
|
mainProgram = "unciv";
|
|
homepage = "https://github.com/yairm210/Unciv";
|
|
maintainers = with maintainers; [ tex ];
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
|
license = licenses.mpl20;
|
|
platforms = platforms.all;
|
|
};
|
|
}
|