nixpkgs/pkgs/tools/nix/fh/default.nix
2023-12-14 22:30:03 +00:00

56 lines
1.3 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, darwin
, gcc
, libcxx
}:
rustPlatform.buildRustPackage rec {
pname = "fh";
version = "0.1.9";
src = fetchFromGitHub {
owner = "DeterminateSystems";
repo = "fh";
rev = "v${version}";
hash = "sha256-G2bLYand61E/s652Q+5XSfXdM6XUWixiXRRMd3HvfM4=";
};
cargoHash = "sha256-c3XxJQf2uHvj1X/djKyQg2AtrXdROyIVwLeYxFgHDNI=";
nativeBuildInputs = [
installShellFiles
rustPlatform.bindgenHook
];
buildInputs = lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
gcc.cc.lib
];
env = lib.optionalAttrs stdenv.isDarwin {
NIX_CFLAGS_COMPILE = "-I${lib.getDev libcxx}/include/c++/v1";
};
postInstall = ''
installShellCompletion --cmd fh \
--bash <($out/bin/fh completion bash) \
--fish <($out/bin/fh completion fish) \
--zsh <($out/bin/fh completion zsh)
'';
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "The official FlakeHub CLI";
homepage = "https://github.com/DeterminateSystems/fh";
changelog = "https://github.com/DeterminateSystems/fh/releases/tag/${src.rev}";
license = licenses.asl20;
maintainers = with maintainers; [ figsoda ];
mainProgram = "fh";
};
}