1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6 writableTmpDirAsHomeHook,
7 versionCheckHook,
8}:
9
10rustPlatform.buildRustPackage (finalAttrs: {
11 pname = "tmc-cli";
12 version = "1.1.2";
13
14 src = fetchFromGitHub {
15 owner = "rage";
16 repo = "tmc-cli-rust";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-C7X+XTOqquqf/W29+A4wUUl6aDZYLlc5XokkIOrCbp0=";
19 };
20
21 cargoHash = "sha256-2KoHKTN1Jvyvk9ravi0a9D+RIFYa1KmHLJQzKT2iP9A=";
22
23 nativeCheckInputs = [
24 writableTmpDirAsHomeHook
25 ];
26
27 checkFlags = lib.optionals stdenv.hostPlatform.isDarwin [
28 # When sandboxing, "Attempted to create a NULL object."
29 # https://github.com/mullvad/system-configuration-rs/pull/59 may fix.
30 "--skip=commands::courses::tests::list_courses_with_client_test"
31 # Same
32 "--skip=all_integration_tests"
33 # When sandboxing, "Lazy instance has previously been poisoned."
34 "--skip=commands::exercises::tests::list_exercises_with_client_test"
35 ];
36
37 nativeInstallCheckInputs = [
38 versionCheckHook
39 ];
40 doInstallCheck = true;
41 versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
42 versionCheckProgramArg = "--version";
43
44 __darwinAllowLocalNetworking = true;
45
46 meta = {
47 description = "CLI for using the TestMyCode programming assignment evaluator";
48 homepage = "https://github.com/rage/tmc-cli-rust";
49 changelog = "https://github.com/rage/tmc-cli-rust/releases/tag/v${finalAttrs.version}";
50 license = lib.licenses.asl20;
51 maintainers = with lib.maintainers; [ hekazu ];
52 mainProgram = "tmc";
53 };
54})