Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# This file is based upon upstream's package.nix shared among both
2# "ssh-openpgp-auth" and "sshd-openpgpg-auth"
3{
4 lib,
5 rustPlatform,
6 fetchFromGitea,
7 pkg-config,
8 just,
9 rust-script,
10 installShellFiles,
11 nettle,
12 openssl,
13 sqlite,
14 openssh,
15 # Arguments not supplied by callPackage
16 pname,
17 version,
18 srcHash,
19 cargoHash,
20 metaDescription,
21}:
22
23rustPlatform.buildRustPackage {
24 inherit pname version;
25
26 src = fetchFromGitea {
27 domain = "codeberg.org";
28 owner = "wiktor";
29 repo = "ssh-openpgp-auth";
30 # See also: https://codeberg.org/wiktor/ssh-openpgp-auth/pulls/92#issuecomment-1635274
31 rev = "${pname}/${version}";
32 hash = srcHash;
33 };
34 buildAndTestSubdir = pname;
35
36 inherit cargoHash;
37
38 nativeBuildInputs = [
39 pkg-config
40 rustPlatform.bindgenHook
41 just
42 rust-script
43 installShellFiles
44 ];
45 # Otherwise just's build, check and install phases take precedence over
46 # buildRustPackage's phases.
47 dontUseJustBuild = true;
48 dontUseJustCheck = true;
49 dontUseJustInstall = true;
50
51 postInstall = ''
52 export HOME=$(mktemp -d)
53 just generate manpages ${pname} $out/share/man/man1
54 just generate shell_completions ${pname} shell_completions
55 installShellCompletion --cmd ${pname} \
56 --bash shell_completions/${pname}.bash \
57 --fish shell_completions/${pname}.fish \
58 --zsh shell_completions/_${pname}
59 '';
60
61 buildInputs = [
62 nettle
63 openssl
64 sqlite
65 ];
66
67 doCheck = true;
68 nativeCheckInputs = [
69 openssh
70 ];
71
72 meta = with lib; {
73 description = metaDescription;
74 homepage = "https://codeberg.org/wiktor/ssh-openpgp-auth";
75 license = with licenses; [
76 mit # or
77 asl20
78 ];
79 maintainers = with maintainers; [ doronbehar ];
80 mainProgram = pname;
81 };
82}