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