nixpkgs/pkgs/by-name/fl/flawz/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
1.8 KiB
Nix
Raw Normal View History

2024-10-25 10:34:25 +00:00
{
lib,
fetchFromGitHub,
rustPlatform,
pkg-config,
openssl,
sqlite,
installShellFiles,
stdenv,
buildPackages,
2024-05-21 10:20:27 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "flawz";
2024-11-04 02:36:18 +00:00
version = "0.3.0";
2024-05-21 10:20:27 +00:00
src = fetchFromGitHub {
owner = "orhun";
repo = "flawz";
rev = "v${version}";
2024-11-04 02:36:18 +00:00
hash = "sha256-7p/BUXrElJutUcRMu+LxdsMxA6lCDnaci0fDaKGsawI=";
2024-05-21 10:20:27 +00:00
};
2024-11-04 02:36:18 +00:00
cargoHash = "sha256-jVAMnU2NnL/2Hri6NxSUkIfQ/bJ5wMZ+oFOTMPrFE0M=";
2024-05-21 10:20:27 +00:00
2024-10-25 10:34:25 +00:00
nativeBuildInputs = [
pkg-config
installShellFiles
];
2024-05-21 10:20:27 +00:00
2024-10-25 10:34:25 +00:00
buildInputs = [
openssl
sqlite
];
outputs = [
"out"
"man"
];
2024-05-21 10:20:27 +00:00
postInstall =
let
emulator = stdenv.hostPlatform.emulator buildPackages;
flawz-mangen = "${emulator} $out/bin/flawz-mangen";
flawz-completions = "${emulator} $out/bin/flawz-completions";
in
lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
export OUT_DIR=$(mktemp -d)
2024-05-21 10:20:27 +00:00
# Generate the man pages
${flawz-mangen}
installManPage $OUT_DIR/flawz.1
2024-05-21 10:20:27 +00:00
# Generate shell completions
${flawz-completions}
installShellCompletion \
--bash $OUT_DIR/flawz.bash \
--fish $OUT_DIR/flawz.fish \
--zsh $OUT_DIR/_flawz
2024-05-21 10:20:27 +00:00
# Clean up temporary directory
rm -rf $OUT_DIR
# No need for these binaries to end up in the output
rm $out/bin/flawz-{completions,mangen}
'';
2024-05-21 10:20:27 +00:00
meta = {
description = "Terminal UI for browsing CVEs";
homepage = "https://github.com/orhun/flawz";
changelog = "https://github.com/orhun/flawz/releases/tag/v${version}";
2024-10-25 10:34:25 +00:00
license = with lib.licenses; [
mit
asl20
];
2024-05-21 10:20:27 +00:00
mainProgram = "flawz";
maintainers = with lib.maintainers; [ anas ];
platforms = with lib.platforms; unix ++ windows;
broken = stdenv.hostPlatform.isDarwin; # needing some apple_sdk packages
};
}