nixpkgs/pkgs/development/tools/ldid/default.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

67 lines
1.2 KiB
Nix

{ lib
, stdenv
, fetchgit
, libplist
, libxml2
, openssl
, CoreFoundation
, Security
}:
stdenv.mkDerivation rec {
pname = "ldid";
version = "2.1.5";
src = fetchgit {
url = "git://git.saurik.com/ldid.git";
rev = "v${version}";
hash = "sha256-RM5pU3mrgyvwNfWKNvCT3UYVGKtVhD7ifgp8fq9xXiM=";
};
strictDeps = true;
buildInputs = [
libplist
libxml2
openssl
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
CoreFoundation
Security
];
NIX_LDFLAGS = [
"-lcrypto"
"-lplist-2.0"
"-lxml2"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
"-framework CoreFoundation"
"-framework Security"
];
buildPhase = ''
runHook preBuild
cc -c -o lookup2.o lookup2.c -I.
c++ -std=c++11 -o ldid lookup2.o ldid.cpp -I. ${toString NIX_LDFLAGS}
runHook postBuild
'';
installPhase = ''
runHook preInstall
install -Dm755 {,$out/bin/}ldid
ln -s $out/bin/ldid $out/bin/ldid2
runHook postInstall
'';
meta = with lib; {
description = "Link Identity Editor";
homepage = "https://cydia.saurik.com/info/ldid/";
maintainers = with maintainers; [ wegank ];
platforms = platforms.unix;
license = licenses.agpl3Only;
};
}