Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# Lint GitHub Actions workflows. Silently skipped if actionlint is not installed.
check:
Expand Down
2 changes: 1 addition & 1 deletion demo/boy/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# Run the GB demo: relay + emulator publisher + web viewer.
default:
Expand Down
4 changes: 3 additions & 1 deletion demo/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

mod boy
mod pub
Expand All @@ -10,6 +10,7 @@ mod web
#
# Picks the first free port at/after 4443 (both UDP for QUIC and TCP for HTTP)
# so multiple worktrees can run `just dev` without colliding. The relay reads

# the port from MOQ_SERVER_BIND/MOQ_WEB_HTTP_LISTEN, overriding localhost.toml.
default:
#!/usr/bin/env bash
Expand All @@ -33,6 +34,7 @@ default:
# Find the first free port at/after `start` (checked on both TCP and UDP).
# `lsof` isn't available everywhere (e.g. Git Bash on Windows); without it we
# can't probe, so fall back to `start` and let the relay surface a bind error if

# it's actually taken.
[private]
port start="4443":
Expand Down
3 changes: 2 additions & 1 deletion demo/pub/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# --- R2 bucket management (vid.moq.dev) ---

Expand Down Expand Up @@ -258,6 +258,7 @@ ffmpeg-cmaf input output='-' *args:
#
# `-pes_payload_size 0` flushes one PES per audio frame instead of batching ~8
# (the default 2930-byte minimum), so audio interleaves evenly with video rather

# than arriving in ~185ms bursts. Without it the player must buffer a whole burst.
[private]
ffmpeg-ts input output='-' *args:
Expand Down
3 changes: 2 additions & 1 deletion demo/relay/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# Run a localhost relay server without authentication.
default:
Expand All @@ -7,6 +7,7 @@ default:
# Run a cluster of relay servers.
#
# The relays grant anonymous access (see *.toml), so no JWT is needed locally.

# Cluster peers still authenticate to each other via mTLS (the cert/ca recipes).
cluster:
bun install
Expand Down
2 changes: 1 addition & 1 deletion demo/sub/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# Subscribe to a broadcast using GStreamer and render to the screen.
gst name url='http://localhost:4443' *args:
Expand Down
1 change: 1 addition & 0 deletions demo/web/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ default:

# Run the web server targeting the specified relay.
# The vite config opens the watch, publish, and stats demos in separate tabs;

# set MOQ_NO_OPEN=1 to skip opening a browser.
serve url='http://localhost:4443':
VITE_RELAY_URL="{{ url }}" bun --bun vite
88 changes: 45 additions & 43 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@
"rust-src"
"rust-analyzer"
];
targets = [
"wasm32-unknown-unknown"
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
"x86_64-apple-darwin"
"aarch64-apple-darwin"
];
targets =
[
"wasm32-unknown-unknown"
]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
"x86_64-apple-darwin"
"aarch64-apple-darwin"
];
};

# GStreamer dependencies (for moq-gst plugin)
Expand Down Expand Up @@ -178,47 +179,48 @@
overlayPkgs = pkgs.extend self.overlays.default;
in
{
packages = (rec {
default = pkgs.symlinkJoin {
name = "moq-all";
paths = [
packages =
(rec {
default = pkgs.symlinkJoin {
name = "moq-all";
paths = [
moq-relay
moq-cli
moq-token-cli
];
};

# Inherit packages from the overlay
inherit (overlayPkgs)
moq-relay
moq-cli
moq-token-cli
];
};
moq-boy
libmoq
moq-gst
;

# Inherit packages from the overlay
inherit (overlayPkgs)
moq-relay
moq-cli
moq-token-cli
moq-boy
libmoq
moq-gst
;

# Bundle of packaging + repo-publish tooling, pinned via flake.lock.
# CI builds this and prepends its bin/ to $PATH so subsequent steps
# use the same versions a local `nix develop` user would.
packaging = pkgs.symlinkJoin {
name = "moq-packaging-tools";
paths = packagingDeps ++ publishDeps;
# Bundle of packaging + repo-publish tooling, pinned via flake.lock.
# CI builds this and prepends its bin/ to $PATH so subsequent steps
# use the same versions a local `nix develop` user would.
packaging = pkgs.symlinkJoin {
name = "moq-packaging-tools";
paths = packagingDeps ++ publishDeps;
};
})
# x86_64-darwin release artifacts are cross-compiled from the
# aarch64-darwin runner (see nix/overlay.nix). The cross outputs only
# evaluate on an aarch64-darwin host, so gate them on the system to
# keep `nix flake check` working on Linux and Intel macs.
// pkgs.lib.optionalAttrs (system == "aarch64-darwin") {
inherit (overlayPkgs)
moq-relay-x86_64-apple-darwin
moq-cli-x86_64-apple-darwin
moq-token-cli-x86_64-apple-darwin
libmoq-x86_64-apple-darwin
moq-gst-plugin-x86_64-apple-darwin
;
};
})
# x86_64-darwin release artifacts are cross-compiled from the
# aarch64-darwin runner (see nix/overlay.nix). The cross outputs only
# evaluate on an aarch64-darwin host, so gate them on the system to
# keep `nix flake check` working on Linux and Intel macs.
// pkgs.lib.optionalAttrs (system == "aarch64-darwin") {
inherit (overlayPkgs)
moq-relay-x86_64-apple-darwin
moq-cli-x86_64-apple-darwin
moq-token-cli-x86_64-apple-darwin
libmoq-x86_64-apple-darwin
moq-gst-plugin-x86_64-apple-darwin
;
};

# Re-export gst_all_1 so users can pair the plugin with a matching
# gstreamer in one nix invocation:
Expand Down
5 changes: 5 additions & 0 deletions go/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,34 @@ default:
# Build moq-ffi for the host, run uniffi-bindgen-go, stage both the ffi and
# wrapper modules into dist/ (wiring the wrapper to the local ffi via replace),
# and run `go build`/`go vet`/`go test`. Skips cleanly if cargo, go, or

# uniffi-bindgen-go is missing.
check:
bash scripts/check.sh

# Stage the in-tree go/ffi source + per-target moq-ffi libs + generated

# bindings into the moq-go-ffi module ready for publish.
package-ffi *args:
bash scripts/package-ffi.sh {{ args }}

# Stage the in-tree go/wrapper source into the moq-go module, rewriting its

# moq-go-ffi require to the target ffi version, ready for publish.
package-wrapper *args:
bash scripts/package-wrapper.sh {{ args }}

# Remove the generated bindings, native libs, and vendoring that
# scripts/check.sh produces in go/ (see go/.gitignore). The tmp staging

# under the workspace dist/ is swept by `just js clean`.
clean:
rm -rf moq/moq.go moq/lib go.sum vendor

# Full Go CI: `check` builds moq-ffi, regenerates bindings, runs go
# vet/build/test. Takes a newline-separated list of changed files;
# skips if FILES is non-empty and none match the Go scope. Run

# `just go ci` (no FILES) to force-run.
ci FILES="":
#!/usr/bin/env bash
Expand Down
2 changes: 1 addition & 1 deletion infra/apt/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# Deploy the apt.moq.dev worker.
deploy:
Expand Down
2 changes: 1 addition & 1 deletion infra/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

mod apt
mod rpm
Expand Down
2 changes: 1 addition & 1 deletion infra/rpm/justfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set fallback
set fallback := true

# Deploy the rpm.moq.dev worker.
deploy:
Expand Down
1 change: 1 addition & 0 deletions js/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ build:
bun run --filter='*' build

# Remove node_modules and build output. The bun workspace spans the repo

# (deps hoist to the root, not into js/), so sweep from the workspace root.
clean:
#!/usr/bin/env bash
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ mod py
mod kt
mod swift
mod go

# Unit tests per language (`just test`).
mod test

# Demos and infra.
mod demo
mod infra
Expand Down Expand Up @@ -140,6 +138,7 @@ build:
# .cargo/config.toml. The profile already optimizes for size; wasm-opt is
# skipped since it didn't improve the gzipped (over-the-wire) size here.
# Resolve the artifact via CARGO_TARGET_DIR so it also works on runners that

# redirect the target directory (it defaults to `target`).
wasm:
cargo build -p moq-wasm --target wasm32-unknown-unknown --profile wasm-release
Expand All @@ -149,6 +148,7 @@ wasm:
# Delete build artifacts and caches to reclaim disk space. Each language
# owns its own `clean` (see js/rs/py/kt/swift/go justfiles); this
# orchestrates them, sweeps the caches no language owns, then recurses into

# any agent worktrees under .claude/worktrees/.
clean:
#!/usr/bin/env bash
Expand Down
1 change: 1 addition & 0 deletions kt/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package *args:
bash scripts/package.sh {{ args }}

# Remove gradle output plus the moq-ffi bindings and native libs that

# scripts/check.sh generates into the source tree (see kt/.gitignore).
clean:
#!/usr/bin/env bash
Expand Down
73 changes: 37 additions & 36 deletions nix/modules/moq-relay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,45 +215,46 @@ in
AmbientCapabilities = lib.optional (cfg.port < 1024) "CAP_NET_BIND_SERVICE";
};

environment = {
# Enable jemalloc heap profiling; dump with `kill -USR1 <pid>`
MALLOC_CONF = "prof:true,prof_active:true,prof_prefix:${cfg.heapDumpPrefix}";
environment =
{
# Enable jemalloc heap profiling; dump with `kill -USR1 <pid>`
MALLOC_CONF = "prof:true,prof_active:true,prof_prefix:${cfg.heapDumpPrefix}";

MOQ_LOG_LEVEL = lib.mkDefault cfg.logLevel;
MOQ_LOG_LEVEL = lib.mkDefault cfg.logLevel;

# Server configuration
MOQ_SERVER_BIND = "[::]:${toString cfg.port}";
# Server configuration
MOQ_SERVER_BIND = "[::]:${toString cfg.port}";

MOQ_CLIENT_TLS_DISABLE_VERIFY = lib.boolToString cfg.cluster.disableTlsVerify;
}
// lib.optionalAttrs (cfg.tls.generate != [ ]) {
# TLS configuration
MOQ_SERVER_TLS_GENERATE = lib.concatStringsSep "," cfg.tls.generate;
}
// lib.optionalAttrs (cfg.tls.certs != [ ]) {
MOQ_SERVER_TLS_CERT = lib.concatMapStringsSep "," (cert: "${cert.chain}") cfg.tls.certs;
}
// lib.optionalAttrs (cfg.tls.certs != [ ]) {
MOQ_SERVER_TLS_KEY = lib.concatMapStringsSep "," (cert: "${cert.key}") cfg.tls.certs;
}
// lib.optionalAttrs cfg.auth.enable {
# Auth configuration
MOQ_AUTH_KEY = if cfg.auth.keyFile != null then cfg.auth.keyFile else "${cfg.stateDir}/root.jwk";
}
// lib.optionalAttrs (cfg.auth.publicPath != null) {
MOQ_AUTH_PUBLIC = cfg.auth.publicPath;
}
// lib.optionalAttrs (cfg.cluster.rootUrl != null) {
# Cluster configuration
MOQ_CLUSTER_ROOT = cfg.cluster.rootUrl;
}
// lib.optionalAttrs (cfg.cluster.mode != "none") {
MOQ_CLUSTER_TOKEN =
if cfg.cluster.tokenFile != null then cfg.cluster.tokenFile else "${cfg.stateDir}/cluster.jwt";
}
// lib.optionalAttrs (cfg.cluster.nodeUrl != null) {
MOQ_CLUSTER_NODE = cfg.cluster.nodeUrl;
};
MOQ_CLIENT_TLS_DISABLE_VERIFY = lib.boolToString cfg.cluster.disableTlsVerify;
}
// lib.optionalAttrs (cfg.tls.generate != [ ]) {
# TLS configuration
MOQ_SERVER_TLS_GENERATE = lib.concatStringsSep "," cfg.tls.generate;
}
// lib.optionalAttrs (cfg.tls.certs != [ ]) {
MOQ_SERVER_TLS_CERT = lib.concatMapStringsSep "," (cert: "${cert.chain}") cfg.tls.certs;
}
// lib.optionalAttrs (cfg.tls.certs != [ ]) {
MOQ_SERVER_TLS_KEY = lib.concatMapStringsSep "," (cert: "${cert.key}") cfg.tls.certs;
}
// lib.optionalAttrs cfg.auth.enable {
# Auth configuration
MOQ_AUTH_KEY = if cfg.auth.keyFile != null then cfg.auth.keyFile else "${cfg.stateDir}/root.jwk";
}
// lib.optionalAttrs (cfg.auth.publicPath != null) {
MOQ_AUTH_PUBLIC = cfg.auth.publicPath;
}
// lib.optionalAttrs (cfg.cluster.rootUrl != null) {
# Cluster configuration
MOQ_CLUSTER_ROOT = cfg.cluster.rootUrl;
}
// lib.optionalAttrs (cfg.cluster.mode != "none") {
MOQ_CLUSTER_TOKEN =
if cfg.cluster.tokenFile != null then cfg.cluster.tokenFile else "${cfg.stateDir}/cluster.jwt";
}
// lib.optionalAttrs (cfg.cluster.nodeUrl != null) {
MOQ_CLUSTER_NODE = cfg.cluster.nodeUrl;
};
};
};
}
Loading
Loading