mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 20:55:31 +03:00
broadcast-box: init at 2025-06-04
This commit is contained in:
parent
13188a62fa
commit
0cbfabfa48
2 changed files with 82 additions and 0 deletions
13
pkgs/by-name/br/broadcast-box/allow-no-env.patch
Normal file
13
pkgs/by-name/br/broadcast-box/allow-no-env.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
diff --git a/main.go b/main.go
|
||||
index 1814da0..2befc13 100644
|
||||
--- a/main.go
|
||||
+++ b/main.go
|
||||
@@ -175,6 +175,8 @@ func main() {
|
||||
if os.Getenv("APP_ENV") == "development" {
|
||||
log.Println("Loading `" + envFileDev + "`")
|
||||
return godotenv.Load(envFileDev)
|
||||
+ } else if os.Getenv("APP_ENV") == "nixos" {
|
||||
+ return nil
|
||||
} else {
|
||||
if _, err := os.Stat("./web/build"); os.IsNotExist(err) {
|
||||
return noBuildDirectoryErr
|
69
pkgs/by-name/br/broadcast-box/package.nix
Normal file
69
pkgs/by-name/br/broadcast-box/package.nix
Normal file
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
lib,
|
||||
nixosTests,
|
||||
fetchFromGitHub,
|
||||
buildNpmPackage,
|
||||
buildGoModule,
|
||||
}:
|
||||
let
|
||||
name = "broadcast-box";
|
||||
version = "0-unstable-2025-06-04";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
repo = "broadcast-box";
|
||||
owner = "Glimesh";
|
||||
rev = "a091f147f750759084a2c9d25a12e815e2feebf8";
|
||||
hash = "sha256-Evhye+DYtFM/VjxqmhH5kU32khvEFUxTUgH9DXytIbo=";
|
||||
};
|
||||
|
||||
frontend = buildNpmPackage {
|
||||
inherit version;
|
||||
pname = "${name}-web";
|
||||
src = "${src}/web";
|
||||
npmDepsHash = "sha256-e1cCezmF20Q6JEXwPb1asRSXuC/GGaR+ImvrTabLl5c=";
|
||||
preBuild = ''
|
||||
# The VITE_API_PATH environment variable is needed
|
||||
cp "${src}/.env.production" ../
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r build $out
|
||||
'';
|
||||
};
|
||||
in
|
||||
buildGoModule {
|
||||
inherit version src frontend;
|
||||
pname = name;
|
||||
vendorHash = "sha256-Jpee7UmG9AB9SOoTv2fPP2l5BmkDPPdciGFu9Naq9h8=";
|
||||
proxyVendor = true; # fixes darwin/linux hash mismatch
|
||||
|
||||
patches = [ ./allow-no-env.patch ];
|
||||
postPatch = ''
|
||||
substituteInPlace main.go \
|
||||
--replace-fail './web/build' '${placeholder "out"}/share'
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/share
|
||||
cp -r $frontend/build/* $out/share
|
||||
|
||||
install -Dm755 $GOPATH/bin/broadcast-box -t $out/bin
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) broadcast-box;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "WebRTC broadcast server";
|
||||
homepage = "https://github.com/Glimesh/broadcast-box";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ JManch ];
|
||||
platforms = lib.platforms.unix;
|
||||
mainProgram = "broadcast-box";
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue