tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
broadcast-box: init at 2025-06-04
Joshua Manchester
8 months ago
0cbfabfa
13188a62
+82
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
br
broadcast-box
allow-no-env.patch
package.nix
+13
pkgs/by-name/br/broadcast-box/allow-no-env.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
diff --git a/main.go b/main.go
2
+
index 1814da0..2befc13 100644
3
+
--- a/main.go
4
+
+++ b/main.go
5
+
@@ -175,6 +175,8 @@ func main() {
6
+
if os.Getenv("APP_ENV") == "development" {
7
+
log.Println("Loading `" + envFileDev + "`")
8
+
return godotenv.Load(envFileDev)
9
+
+ } else if os.Getenv("APP_ENV") == "nixos" {
10
+
+ return nil
11
+
} else {
12
+
if _, err := os.Stat("./web/build"); os.IsNotExist(err) {
13
+
return noBuildDirectoryErr
+69
pkgs/by-name/br/broadcast-box/package.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{
2
+
lib,
3
+
nixosTests,
4
+
fetchFromGitHub,
5
+
buildNpmPackage,
6
+
buildGoModule,
7
+
}:
8
+
let
9
+
name = "broadcast-box";
10
+
version = "0-unstable-2025-06-04";
11
+
12
+
src = fetchFromGitHub {
13
+
repo = "broadcast-box";
14
+
owner = "Glimesh";
15
+
rev = "a091f147f750759084a2c9d25a12e815e2feebf8";
16
+
hash = "sha256-Evhye+DYtFM/VjxqmhH5kU32khvEFUxTUgH9DXytIbo=";
17
+
};
18
+
19
+
frontend = buildNpmPackage {
20
+
inherit version;
21
+
pname = "${name}-web";
22
+
src = "${src}/web";
23
+
npmDepsHash = "sha256-e1cCezmF20Q6JEXwPb1asRSXuC/GGaR+ImvrTabLl5c=";
24
+
preBuild = ''
25
+
# The VITE_API_PATH environment variable is needed
26
+
cp "${src}/.env.production" ../
27
+
'';
28
+
installPhase = ''
29
+
mkdir -p $out
30
+
cp -r build $out
31
+
'';
32
+
};
33
+
in
34
+
buildGoModule {
35
+
inherit version src frontend;
36
+
pname = name;
37
+
vendorHash = "sha256-Jpee7UmG9AB9SOoTv2fPP2l5BmkDPPdciGFu9Naq9h8=";
38
+
proxyVendor = true; # fixes darwin/linux hash mismatch
39
+
40
+
patches = [ ./allow-no-env.patch ];
41
+
postPatch = ''
42
+
substituteInPlace main.go \
43
+
--replace-fail './web/build' '${placeholder "out"}/share'
44
+
'';
45
+
46
+
installPhase = ''
47
+
runHook preInstall
48
+
49
+
mkdir -p $out/share
50
+
cp -r $frontend/build/* $out/share
51
+
52
+
install -Dm755 $GOPATH/bin/broadcast-box -t $out/bin
53
+
54
+
runHook postInstall
55
+
'';
56
+
57
+
passthru.tests = {
58
+
inherit (nixosTests) broadcast-box;
59
+
};
60
+
61
+
meta = {
62
+
description = "WebRTC broadcast server";
63
+
homepage = "https://github.com/Glimesh/broadcast-box";
64
+
license = lib.licenses.mit;
65
+
maintainers = with lib.maintainers; [ JManch ];
66
+
platforms = lib.platforms.unix;
67
+
mainProgram = "broadcast-box";
68
+
};
69
+
}