|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + buildGoModule, |
| 5 | + fetchFromGitHub, |
| 6 | + buildPackages, |
| 7 | + installShellFiles, |
| 8 | + nix-update-script, |
| 9 | +}: |
| 10 | + |
| 11 | +let |
| 12 | + version = "0.16.10"; |
| 13 | +in |
| 14 | +buildGoModule { |
| 15 | + pname = "mrpack-install"; |
| 16 | + inherit version; |
| 17 | + |
| 18 | + src = fetchFromGitHub { |
| 19 | + owner = "nothub"; |
| 20 | + repo = "mrpack-install"; |
| 21 | + tag = "v${version}"; |
| 22 | + hash = "sha256-mTAXFK97t10imdICpg0UI4YLF744oscJqoOIBG5GEkc="; |
| 23 | + }; |
| 24 | + |
| 25 | + vendorHash = "sha256-az+NpP/hCIq2IfO8Bmn/qG3JVypeDljJ0jWg6yT6hks="; |
| 26 | + |
| 27 | + ldflags = [ |
| 28 | + "-s" |
| 29 | + "-w" |
| 30 | + "-X github.com/nothub/mrpack-install/buildinfo.version=${version}" |
| 31 | + "-X github.com/nothub/mrpack-install/buildinfo.date=1970-01-01T00:00:00Z" |
| 32 | + ]; |
| 33 | + |
| 34 | + checkFlags = |
| 35 | + let |
| 36 | + skippedTests = [ |
| 37 | + # Skip tests that require network access |
| 38 | + "TestFetchMetadata" |
| 39 | + "TestClient_VersionFromHash" |
| 40 | + "TestClient_GetDependencies" |
| 41 | + "TestClient_GetProjectVersions_Count" |
| 42 | + "TestClient_GetVersion" |
| 43 | + "TestClient_CheckProjectValidity_Slug" |
| 44 | + "Test_GetProject_404" |
| 45 | + "TestClient_GetProjects_Count" |
| 46 | + "TestClient_GetProjectVersions_Filter_NoResults" |
| 47 | + "Test_GetProject_Success" |
| 48 | + "TestClient_CheckProjectValidity_Id" |
| 49 | + "TestClient_GetLatestGameVersion" |
| 50 | + "TestClient_GetProjectVersions_Filter_Results" |
| 51 | + "TestClient_GetProjects_Slug" |
| 52 | + "TestClient_GetVersions" |
| 53 | + "TestGetPlayerUuid" |
| 54 | + ]; |
| 55 | + in |
| 56 | + [ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]; |
| 57 | + |
| 58 | + nativeBuildInputs = [ |
| 59 | + installShellFiles |
| 60 | + ]; |
| 61 | + |
| 62 | + postInstall = |
| 63 | + let |
| 64 | + mrpack-install = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/mrpack-install"; |
| 65 | + in |
| 66 | + lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' |
| 67 | + installShellCompletion --cmd mrpack-install \ |
| 68 | + --bash <(${mrpack-install} completion bash) \ |
| 69 | + --fish <(${mrpack-install} completion fish) \ |
| 70 | + --zsh <(${mrpack-install} completion zsh) |
| 71 | + ''; |
| 72 | + |
| 73 | + passthru.updateScript = nix-update-script { }; |
| 74 | + |
| 75 | + meta = { |
| 76 | + description = "CLI application for installing Minecraft servers and Modrinth modpacks"; |
| 77 | + homepage = "https://github.com/nothub/mrpack-install"; |
| 78 | + license = lib.licenses.mit; |
| 79 | + maintainers = with lib.maintainers; [ encode42 ]; |
| 80 | + mainProgram = "mrpack-install"; |
| 81 | + }; |
| 82 | +} |
0 commit comments