mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-27 22:44:56 +00:00

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" ```
58 lines
1.4 KiB
Nix
58 lines
1.4 KiB
Nix
{ stdenv
|
|
, lib
|
|
, fetchFromGitHub
|
|
, rustPlatform
|
|
, AppKit
|
|
, Cocoa
|
|
, Foundation
|
|
, installShellFiles
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "topgrade";
|
|
version = "15.0.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "topgrade-rs";
|
|
repo = "topgrade";
|
|
rev = "v${version}";
|
|
hash = "sha256-w3JsMUuARJ5UtA8Io3kzeNjXoa014YzyT8hHPwEgljQ=";
|
|
};
|
|
|
|
cargoHash = "sha256-DEZlpt9mOy/BOnvkkINz2+q3hUx2aBSzBfOVxv43w6g=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
|
AppKit
|
|
Cocoa
|
|
Foundation
|
|
];
|
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.hostPlatform.isDarwin [
|
|
"-framework"
|
|
"AppKit"
|
|
]);
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd topgrade \
|
|
--bash <($out/bin/topgrade --gen-completion bash) \
|
|
--fish <($out/bin/topgrade --gen-completion fish) \
|
|
--zsh <($out/bin/topgrade --gen-completion zsh)
|
|
|
|
$out/bin/topgrade --gen-manpage > topgrade.8
|
|
installManPage topgrade.8
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Upgrade all the things";
|
|
homepage = "https://github.com/topgrade-rs/topgrade";
|
|
changelog = "https://github.com/topgrade-rs/topgrade/releases/tag/v${version}";
|
|
license = licenses.gpl3Only;
|
|
maintainers = with maintainers; [ SuperSandro2000 xyenon ];
|
|
mainProgram = "topgrade";
|
|
};
|
|
}
|