nixpkgs/pkgs/by-name/co/codeberg-cli/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

57 lines
1.3 KiB
Nix

{
darwin,
fetchFromGitea,
installShellFiles,
lib,
openssl,
pkg-config,
rustPlatform,
stdenv,
}:
rustPlatform.buildRustPackage rec {
pname = "codeberg-cli";
version = "0.4.2";
src = fetchFromGitea {
domain = "codeberg.org";
owner = "Aviac";
repo = "codeberg-cli";
rev = "v${version}";
hash = "sha256-SUKV7tH7tvSPtlMcRlOgjvAEqPoBi4J41Ak5k4h4Qj0=";
};
cargoHash = "sha256-FlW0Q2UUt6AX/A0MznGpJY8+yoMs70N58Ow05ly9YyE=";
nativeBuildInputs = [
pkg-config
installShellFiles
];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin (
let
d = darwin.apple_sdk.frameworks;
in
[
d.CoreServices
d.Security
d.SystemConfiguration
]
);
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd berg \
--bash <($out/bin/berg completion bash) \
--fish <($out/bin/berg completion fish) \
--zsh <($out/bin/berg completion zsh)
'';
meta = with lib; {
description = "CLI Tool for Codeberg similar to gh and glab";
homepage = "https://codeberg.org/Aviac/codeberg-cli";
license = with licenses; [ agpl3Plus ];
maintainers = with maintainers; [ robwalt ];
mainProgram = "berg";
};
}