package.nix (1323B)
1 { 2 lib, 3 fetchFromGitHub, 4 buildGoModule, 5 }: 6 7 buildGoModule (finalAttrs: { 8 pname = "volantmq"; 9 version = "0.4.0-rc.8"; 10 11 __structuredAttrs = true; 12 13 src = fetchFromGitHub { 14 owner = "VolantMQ"; 15 repo = "volantmq"; 16 tag = "v${finalAttrs.version}"; 17 hash = "sha256-c/Ae3wYWzi7btzr8+ia6su7NPtvgjtkTxRyPRJduAcY="; 18 }; 19 20 vendorHash = "sha256-YLlYOUTli3FXoNC8bUwLXLdwRxRdZ3zPYpE8KwwhuXM="; 21 22 postPatch = '' 23 substituteInPlace configuration/init.go --replace-fail "/var/lib" "$out/lib" 24 ''; 25 26 subPackages = [ "cmd/volantmq" ]; 27 28 ldflags = [ 29 "-s" 30 "-w" 31 "-X main.version=${finalAttrs.version}" 32 ]; 33 34 postBuild = 35 let 36 plugins = [ 37 "debug" 38 "health" 39 "prometheus" 40 "systree" 41 "persistence_bbolt" 42 "auth_http" 43 ]; 44 in 45 '' 46 ${lib.concatMapStringsSep "\n" (plugin: '' 47 go build -buildmode=plugin -ldflags "${builtins.toString finalAttrs.ldflags}" -o plugins/${plugin}.so 48 '') plugins} 49 ''; 50 51 postInstall = '' 52 install -Dm644 plugins/*.so -t $out/lib/volantmq/plugins 53 ''; 54 55 meta = { 56 description = "High-Performance MQTT Server"; 57 homepage = "https://github.com/VolantMQ/volantmq"; 58 license = lib.licenses.asl20; 59 maintainers = [ lib.maintainers.sikmir ]; 60 mainProgram = "volantmq"; 61 }; 62 })
