about summary refs log tree commit diff
path: root/pkgs/applications/version-management/codeberg-cli/default.nix
blob: ae63280f7ee7c03c21e40ae1a64a349b972a5c6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ lib
, CoreServices
, Security
, fetchFromGitea
, installShellFiles
, openssl
, pkg-config
, rustPlatform
, stdenv
}:
rustPlatform.buildRustPackage rec {
  pname = "codeberg-cli";
  version = "0.3.5";

  src = fetchFromGitea {
    domain = "codeberg.org";
    owner = "RobWalt";
    repo = "codeberg-cli";
    rev = "v${version}";
    hash = "sha256-KjH78yqfZoN24TBYyFZuxf7z9poRov0uFYQ8+eq9p/o=";
  };

  cargoHash = "sha256-RE4Zwa5vUWPc42w5GaaYkS6fLIbges1fAsOUuwqR2ag=";
  nativeBuildInputs = [ pkg-config installShellFiles ];

  buildInputs = [ openssl ]
    ++ lib.optionals stdenv.isDarwin [ CoreServices Security ];

  postInstall = ''
    installShellCompletion --cmd berg \
      --bash <($out/bin/berg completion bash) \
      --fish <($out/bin/berg completion fish) \
      --zsh <($out/bin/berg completion zsh)
  '';

  meta = with lib; {
    description = "CLI Tool for Codeberg similar to gh and glab";
    homepage = "https://codeberg.org/RobWalt/codeberg-cli";
    license = with licenses; [ agpl3Plus ];
    maintainers = with maintainers; [ robwalt ];
    mainProgram = "berg";
  };
}