Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 124 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 coreutils, 7 findutils, 8 gnused, 9 jre, 10 gradle, 11 makeBinaryWrapper, 12 gitMinimal, 13 versionCheckHook, 14}: 15 16stdenv.mkDerivation (finalAttrs: { 17 pname = "structurizr-cli"; 18 version = "2025.05.28"; 19 20 src = fetchFromGitHub { 21 owner = "structurizr"; 22 repo = "cli"; 23 tag = "v${finalAttrs.version}"; 24 hash = "sha256-bypCW7fEfSzVQHhb7wzxQUkXnoDb8QHUsPCpHV7pW/w="; 25 }; 26 strictDeps = true; 27 28 patches = 29 let 30 # Use `gradle-application-plugin` to generate scripts and dist zip instead of in-house launch script 31 # PR at https://github.com/structurizr/cli/pull/175 32 commits = [ 33 # Use `gradle-application-plugin` 34 { 35 rev = "eb1657c2be62fb493adde954330a70eebd72026a"; 36 hash = "sha256-B1vqQNHHSOgiRysc5ZkcBB/8YZ1dMjJuFu5uwGRQKWs="; 37 } 38 # Set JDK target correctly 39 { 40 rev = "24be5eeec893df5261100913c4e51ca0bd100689"; 41 hash = "sha256-tj7fNOqKLPvgTYKCRIJlGg1OGyGOmmx0Pj4H8oDPVdU="; 42 } 43 # Remove unused `git.commit` property 44 { 45 rev = "2cb1d86c59f210ce32211395570e8dccf138df16"; 46 hash = "sha256-wswvXJujyPpbvXvL2SOFC4zZLnfskYFdHvzry66vukQ="; 47 } 48 # Set build data correctly 49 { 50 rev = "3260d8622a9cf6197d6ab5d9440087dcaac3fbb9"; 51 hash = "sha256-0zUmg+smxQLZm9wWu3JL1pIXQJcQ1uyQ433C1pDLatQ="; 52 } 53 # Wrap compatibility into java block 54 { 55 rev = "1a11940d089a8d70d6e298660c6f5db638cc8d00"; 56 hash = "sha256-Myj3s7Kc+bQS3iJIZoEyc39pn3DkBOHFu/B9UUPKXf8="; 57 } 58 ]; 59 in 60 builtins.map ( 61 entry: 62 fetchpatch { 63 url = "https://github.com/structurizr/cli/commit/${entry.rev}.patch"; 64 hash = entry.hash; 65 } 66 ) commits; 67 68 postPatch = '' 69 substituteInPlace src/main/resources/build.properties \ 70 --subst-var-by BUILD_NUMBER "${finalAttrs.version}" \ 71 --subst-var-by BUILD_DATE "1970-01-01T00:00:00Z" 72 ''; 73 74 nativeBuildInputs = [ 75 gradle 76 makeBinaryWrapper 77 gitMinimal 78 ]; 79 80 mitmCache = gradle.fetchDeps { 81 inherit (finalAttrs) pname; 82 data = ./deps.json; 83 }; 84 85 __darwinAllowLocalNetworking = true; 86 87 gradleBuildTask = "installDist"; 88 89 installPhase = '' 90 runHook preInstall 91 92 mkdir -p $out/{bin,lib} 93 cp -r build/install/structurizr-cli $out/lib/structurizr-cli 94 95 makeBinaryWrapper $out/lib/structurizr-cli/bin/structurizr-cli $out/bin/structurizr-cli \ 96 --prefix PATH : "${ 97 lib.makeBinPath [ 98 coreutils 99 findutils 100 gnused 101 jre 102 ] 103 }" 104 105 runHook postInstall 106 ''; 107 108 doInstallCheck = true; 109 nativeInstallCheckInputs = [ versionCheckHook ]; 110 versionCheckProgramArg = "version"; 111 112 meta = { 113 description = "Structurizr CLI for publishing C4 architecture diagrams and models"; 114 homepage = "https://github.com/structurizr/cli"; 115 license = lib.licenses.asl20; 116 maintainers = with lib.maintainers; [ mhemeryck ]; 117 platforms = lib.platforms.all; 118 mainProgram = "structurizr-cli"; 119 sourceProvenance = with lib.sourceTypes; [ 120 fromSource 121 binaryBytecode 122 ]; 123 }; 124})