nixpkgs/pkgs/applications/version-management/git-trim/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

56 lines
1.3 KiB
Nix

{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, pkg-config
, openssl
, libgit2
, IOKit
, CoreFoundation
, Security
, fetchpatch
}:
rustPlatform.buildRustPackage rec {
pname = "git-trim";
version = "0.4.4";
src = fetchFromGitHub {
owner = "foriequal0";
repo = pname;
rev = "v${version}";
sha256 = "sha256-XAO3Qg5I2lYZVNx4+Z5jKHRIFdNwBJsUQwJXFb4CbvM=";
};
cargoHash = "sha256-mS8kNkZs8jX99ryG4XkU+U/iWIIcmET2vOfG1YNNZFU=";
cargoPatches = [
# Update git2 https://github.com/foriequal0/git-trim/pull/202
(fetchpatch {
url = "https://github.com/foriequal0/git-trim/commit/4355cd1d6f605455087c4d7ad16bfb92ffee941f.patch";
sha256 = "sha256-C1pX4oe9ZCgvqYTBJeSjMdr0KFyjv2PNVMJDlwCAngY=";
})
];
OPENSSL_NO_VENDOR = 1;
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl libgit2 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ IOKit CoreFoundation Security ];
postInstall = ''
install -Dm644 -t $out/share/man/man1/ docs/git-trim.1
'';
# fails with sandbox
doCheck = false;
meta = with lib; {
description = "Automatically trims your branches whose tracking remote refs are merged or gone";
homepage = "https://github.com/foriequal0/git-trim";
license = licenses.mit;
maintainers = with maintainers; [ cafkafk ];
mainProgram = "git-trim";
};
}