1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 rustPlatform,
6 installShellFiles,
7 versionCheckHook,
8 nix-update-script,
9}:
10rustPlatform.buildRustPackage (finalAttrs: {
11 pname = "openstack-rs";
12 version = "0.13.1";
13 src = fetchFromGitHub {
14 owner = "gtema";
15 repo = "openstack";
16 tag = "v${finalAttrs.version}";
17 hash = "sha256-wK4CDG0W8cI+64wbK4PMvDy50b0WAktmJo+7Wf1ucjQ=";
18 };
19
20 cargoHash = "sha256-q1Q4GBWmdjIpjyN2wH9baxtgwvF6gG0aaqqVDn1ji44=";
21
22 nativeBuildInputs = [
23 installShellFiles
24 ];
25
26 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
27 installShellCompletion --cmd osc \
28 --bash <($out/bin/osc completion bash) \
29 --fish <($out/bin/osc completion fish) \
30 --zsh <($out/bin/osc completion zsh)
31 '';
32
33 doInstallCheck = true;
34 versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
35 nativeInstallCheckInputs = [ versionCheckHook ];
36
37 passthru.updateScript = nix-update-script { };
38
39 meta = {
40 description = "OpenStack CLI and TUI implemented in Rust";
41 homepage = "https://github.com/gtema/openstack";
42 changelog = "https://github.com/gtema/openstack/releases/tag/v${finalAttrs.version}";
43 license = lib.licenses.asl20;
44 maintainers = with lib.maintainers; [ lykos153 ];
45 mainProgram = "osc";
46 };
47})