openxray: 2188-november-2023-rc1 -> 2921-january-2025-rc1 (#375925)
[NixPkgs.git] / pkgs / by-name / li / license-cli / package.nix
blobc91618db40cc39eb8eecccda9c604ff2d3bf2132
2   lib,
3   fetchFromSourcehut,
4   rustPlatform,
5   installShellFiles,
6   scdoc,
7   makeWrapper,
9   # Script dependencies.
10   fzf,
11   wl-clipboard,
12   xclip,
15 rustPlatform.buildRustPackage rec {
16   pname = "license-cli";
17   version = "3.1.0";
19   src = fetchFromSourcehut {
20     owner = "~zethra";
21     repo = "license";
22     rev = version;
23     hash = "sha256-OGS26mE5rjxlZOaBWhYc7C8aM3Lq2xX0f31LgckjJF8=";
24   };
26   cargoHash = "sha256-Zj9t/e6QhiOxU8mlVRBKEbviSTKXM4WQ3lqtoCcMbMI=";
28   nativeBuildInputs = [
29     installShellFiles
30     makeWrapper
31   ];
33   preInstall = ''
34     ${scdoc}/bin/scdoc < doc/license.scd > license.1
35   '';
37   postInstall = ''
38     installShellCompletion completions/license.{bash,fish}
39     installShellCompletion --zsh completions/_license
40     installManPage ./license.1
42     install -Dm0755 ./scripts/set-license -t $out/bin
43     wrapProgram $out/bin/set-license \
44       --prefix PATH : "$out/bin" \
45       --prefix PATH : ${lib.makeBinPath [ fzf ]}
47     install -Dm0755 ./scripts/copy-header -t $out/bin
48     wrapProgram $out/bin/copy-header \
49       --prefix PATH : "$out/bin" \
50       --prefix PATH : ${
51         lib.makeBinPath [
52           wl-clipboard
53           xclip
54         ]
55       }
56   '';
58   meta = with lib; {
59     homepage = "https://git.sr.ht/~zethra/license";
60     description = "Command-line tool to easily add license to your project";
61     license = licenses.mpl20;
62     mainProgram = "license";
63     maintainers = with maintainers; [ foo-dogsquared ];
64   };