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