nixpkgs/pkgs/by-name/hi/hieroglyphic/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

80 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
cargo,
rustc,
meson,
ninja,
pkg-config,
wrapGAppsHook4,
desktop-file-utils,
glib,
gtk4,
libadwaita,
darwin,
gettext,
appstream,
}:
let
inherit (darwin.apple_sdk.frameworks) CoreFoundation Foundation;
in
stdenv.mkDerivation (finalAttrs: {
pname = "hieroglyphic";
version = "1.1.0";
src = fetchFromGitHub {
owner = "FineFindus";
repo = "Hieroglyphic";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-8UUFatJwtxqumhHd0aiPk6nKsaaF/jIIqMFxXye0X8U=";
};
# We have to use importCargoLock here because `cargo vendor` currently doesn't support workspace
# inheritance within Git dependencies, but importCargoLock does.
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"detexify-0.4.0" = "sha256-BPOHNr3pwu2il3/ERko+WHAWby4rPR49i62tXDlDRu0=";
};
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
meson
ninja
pkg-config
wrapGAppsHook4
desktop-file-utils
appstream
];
buildInputs =
[
glib
gtk4
libadwaita
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
CoreFoundation
Foundation
];
# needed for darwin
env.GETTEXT_DIR = "${gettext}";
meta = {
changelog = "https://github.com/FineFindus/Hieroglyphic/releases/tag/v${finalAttrs.version}";
description = "Tool based on detexify for finding LaTeX symbols from drawings";
homepage = "https://apps.gnome.org/en/Hieroglyphic/";
license = lib.licenses.gpl3Only;
mainProgram = "hieroglyphic";
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
})