package.nix (1314B)
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 "-X main.version=${finalAttrs.version}" 31 ]; 32 33 postBuild = 34 let 35 plugins = [ 36 "debug" 37 "health" 38 "prometheus" 39 "systree" 40 "persistence_bbolt" 41 "auth_http" 42 ]; 43 in 44 '' 45 ${lib.concatMapStringsSep "\n" (plugin: '' 46 go build -buildmode=plugin -ldflags "${builtins.toString finalAttrs.ldflags}" -o plugins/${plugin}.so 47 '') plugins} 48 ''; 49 50 postInstall = '' 51 install -Dm644 plugins/*.so -t $out/lib/volantmq/plugins 52 ''; 53 54 meta = { 55 description = "High-Performance MQTT Server"; 56 homepage = "https://github.com/VolantMQ/volantmq"; 57 license = lib.licenses.asl20; 58 maintainers = [ lib.maintainers.sikmir ]; 59 mainProgram = "volantmq"; 60 }; 61 })
