38 lines
923 B
Nix
38 lines
923 B
Nix
{
|
|
lib
|
|
, stdenv
|
|
, buildPackages
|
|
, rustPlatform
|
|
, installShellFiles
|
|
}:
|
|
let
|
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
|
in
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = cargoToml.package.name;
|
|
version = cargoToml.package.version;
|
|
src = lib.cleanSource ./.;
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
];
|
|
|
|
postInstall = let
|
|
emulator = stdenv.hostPlatform.emulator buildPackages;
|
|
in ''
|
|
installShellCompletion --cmd thumbctl \
|
|
--bash <(${emulator} $out/bin/thumbctl generate-completions --shell bash) \
|
|
--zsh <(${emulator} $out/bin/thumbctl generate-completions --shell zsh) \
|
|
--fish <(${emulator} $out/bin/thumbctl generate-completions --shell fish)
|
|
'';
|
|
|
|
meta = with lib; {
|
|
license = licenses.gpl3Only;
|
|
maintainers = with maintainers; [ h7x4 ];
|
|
platforms = platforms.linux;
|
|
mainProgram = "thumbctl";
|
|
};
|
|
}
|