Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 rustPlatform,
5 fetchFromGitHub,
6 uutils-coreutils,
7 versionCheckHook,
8 nix-update-script,
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "rcodesign";
13 version = "0.29.0";
14
15 src = fetchFromGitHub {
16 owner = "indygreg";
17 repo = "apple-platform-rs";
18 tag = "apple-codesign/${version}";
19 hash = "sha256-NyO0HkldXh94Y16E+SX1VE/OOx0zgO6VYoRLJrEQUm0=";
20 };
21
22 cargoHash = "sha256-KJsTOviCFZ/1eNJLM4+QmK8h6laxN1POl7YMJyu9/g8=";
23
24 cargoBuildFlags = [
25 # Only build the binary we want
26 "--bin=rcodesign"
27 ];
28
29 checkFlags = [
30 # Does network IO
31 "--skip=cli_tests"
32 "--skip=ticket_lookup::test::lookup_ticket"
33 ]
34 ++ lib.optionals stdenv.hostPlatform.isDarwin [
35 # These tests require Xcode to be installed
36 "--skip=parsed_sdk::test::find_all_sdks"
37 "--skip=simple_sdk::test::find_all_sdks"
38 "--skip=test::find_all_platform_directories"
39
40 # Error: Io(Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" })
41 "--skip=test::find_system_xcode_applications"
42 "--skip=test::find_system_xcode_developer_directories"
43 ];
44
45 # Set up uutils-coreutils for cli_tests. Without this, it will be installed with `cargo install`, which will fail
46 # due to the lack of network access in the build environment.
47 preCheck = ''
48 coreutils_dir=''${CARGO_TARGET_DIR:-"$(pwd)/target"}/${stdenv.hostPlatform.rust.cargoShortTarget}/coreutils/bin
49 install -m 755 -d "$coreutils_dir"
50 ln -s '${lib.getExe' uutils-coreutils "uutils-coreutils"}' "$coreutils_dir/coreutils"
51 '';
52
53 nativeInstallCheckInputs = [
54 versionCheckHook
55 ];
56 versionCheckProgramArg = "--version";
57 doInstallCheck = true;
58
59 passthru = {
60 updateScript = nix-update-script { };
61 };
62
63 meta = {
64 description = "Cross-platform CLI interface to interact with Apple code signing";
65 mainProgram = "rcodesign";
66 longDescription = ''
67 rcodesign provides various commands to interact with Apple signing,
68 including signing and notarizing binaries, generating signing
69 certificates, and verifying existing signed binaries.
70
71 For more information, refer to the [documentation](https://gregoryszorc.com/docs/apple-codesign/stable/apple_codesign_rcodesign.html).
72 '';
73 homepage = "https://github.com/indygreg/apple-platform-rs";
74 changelog = "https://github.com/indygreg/apple-platform-rs/releases/tag/apple-codesign%2F${version}";
75 license = lib.licenses.mpl20;
76 maintainers = with lib.maintainers; [ euank ];
77 };
78}