1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitea,
6 pkg-config,
7 installShellFiles,
8 writableTmpDirAsHomeHook,
9 libgit2,
10 oniguruma,
11 openssl,
12 zlib,
13}:
14rustPlatform.buildRustPackage (finalAttrs: {
15 pname = "forgejo-cli";
16 version = "0.3.0";
17
18 src = fetchFromGitea {
19 domain = "codeberg.org";
20 owner = "Cyborus";
21 repo = "forgejo-cli";
22 tag = "v${finalAttrs.version}";
23 hash = "sha256-8KPR7Fx26hj5glKDjczCLP6GgQBUsA5TpjhO5UZOpik=";
24 };
25
26 cargoHash = "sha256-kW7Pexydkosaufk1e8P5FaY+dgkeeTG5qgJxestWkVs=";
27
28 nativeBuildInputs = [
29 pkg-config
30 installShellFiles
31 writableTmpDirAsHomeHook # Needed for shell completions
32 ];
33
34 buildInputs = [
35 libgit2
36 oniguruma
37 openssl
38 zlib
39 ];
40
41 env = {
42 RUSTONIG_SYSTEM_LIBONIG = true;
43 BUILD_TYPE = "nixpkgs";
44 };
45
46 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
47 installShellCompletion --cmd fj \
48 --bash <($out/bin/fj completion bash) \
49 --fish <($out/bin/fj completion fish) \
50 --zsh <($out/bin/fj completion zsh)
51 '';
52
53 meta = {
54 description = "CLI application for interacting with Forgejo";
55 homepage = "https://codeberg.org/Cyborus/forgejo-cli";
56 changelog = "https://codeberg.org/Cyborus/forgejo-cli/releases/tag/v${finalAttrs.version}";
57 license = with lib.licenses; [
58 asl20
59 mit
60 ];
61 maintainers = with lib.maintainers; [
62 awwpotato
63 isabelroses
64 ];
65 mainProgram = "fj";
66 };
67})