{ stdenv, lib, fetchFromGitHub, rustPlatform, installShellFiles, }: rustPlatform.buildRustPackage rec { pname = "topgrade"; version = "16.0.4"; src = fetchFromGitHub { owner = "topgrade-rs"; repo = "topgrade"; rev = "v${version}"; hash = "sha256-b/xzmC49ETGtcf9ekrSkq75cKxSL4ZrvKPkparwz6zU="; }; cargoHash = "sha256-d6jX+3ZcCswhKy5SsSpvXZL9el70+OyIa7lYQ3B/o8M="; nativeBuildInputs = [ installShellFiles ]; 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 = { description = "Upgrade all the things"; homepage = "https://github.com/topgrade-rs/topgrade"; changelog = "https://github.com/topgrade-rs/topgrade/releases/tag/v${version}"; license = lib.licenses.gpl3Only; maintainers = with lib.maintainers; [ SuperSandro2000 xyenon ]; mainProgram = "topgrade"; }; }