Skip to content

Conversation

@gordysunsaronic
Copy link
Contributor

adding back out nix modules

Copy link
Contributor

@therishidesai therishidesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove all of the lines that have "Gordy" in it

flake.nix Outdated
inputsFrom = [
rs.devShells.${system}.default
js.devShells.${system}.default
js.devShells.${system}.default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: whitespace

flake.nix Outdated
js.devShells.${system}.default
];
shellHook = ''
echo "🎯 Using Gordy's Top-Level MoQ Flake (Rust environment only)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove your name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should combine this flake.nix with the top level flake.nix so there is one unified nix flake in the moq repo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just the rs/flake.nix or also the js/flake.nix?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also - problem here is if i combine this with the top level flake.nix, it gives me problems with the js stuff which isn't in the moq-relay server but is related to the webplayer and front end


serviceConfig = {
ExecStart = "${pkgs.moq-relay}/bin/moq-relay --bind [::]:${builtins.toString cfg.port}" +
(if cfg.dev.enable then " --tls-generate ${cfg.dev.tls_url}" else "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these args are up to date with the new moq-relay

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated them

@@ -0,0 +1,34 @@
{ fenix, naersk, flake-utils, ... }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why naersk? We used to use crate2nix in the original moq. I think we should stick to crate2nix as it allows for better caching

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched over to naersk primarily because it doesn't require a separate lockfile (don't want to mandate Nix). I don't know the differences otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that can get updated now, but naersk also works fine. This is a smaller project so shouldn't be an issue with the caching

rs/nix/shell.nix Outdated
@@ -0,0 +1,40 @@
{ self, nixpkgs, flake-utils, fenix, ... }:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the dev shell from the top level nix into this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dev shells have both rs and js, so i gotta keep it at the top level

@gordysunsaronic gordysunsaronic marked this pull request as ready for review July 3, 2025 19:05
Copy link
Contributor

@therishidesai therishidesai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me on the nix side of things. In future PRs let's add a way of validating the config file at eval time I case the underlying rust code gets changed. Let's also add a NixOS VM test for the relay in a future PR.

@kixelated thoughts on this PR?


// If query params are provided, use it as the broadcast name.


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

const urlParams = new URLSearchParams(window.location.search);
const name = urlParams.get("name") ?? "demo/bbb";
watch.setAttribute("url", `http://localhost:4443/${name}.hang`);
const name = urlParams.get("name") ?? "jwt-test/bbb";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?


# Environment variables from moq-rs
shellHook = ''
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deals with some C dependencies in Rust code

rs/justfile Outdated
fi

# Generate publisher-only token
if [ ! -f "dev/bum-publisher.jwt" ]; then \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these?

tomlFormat = pkgs.formats.toml {};

# Build the configuration
configData = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty cool tbh

moq-token = naersk'.buildPackage {
pname = "moq-token-cli";
src = ../.;
cargoBuildOptions = opts: opts ++ [ "-p" "moq-token-cli" ];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also have these options for the other binaries.

rs/nix/shell.nix Outdated
with pkgs;
mkShell {
nativeBuildInputs = [
go
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go?

@kixelated kixelated enabled auto-merge (squash) July 16, 2025 14:52
cursor[bot]

This comment was marked as outdated.

@kixelated kixelated disabled auto-merge July 16, 2025 14:54
@kixelated kixelated enabled auto-merge (squash) July 16, 2025 14:59
@kixelated kixelated merged commit 5ce21b5 into moq-dev:main Jul 16, 2025
3 checks passed
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Moq-Relay Module Fails Due to Incorrect Binary Reference

The moq-relay NixOS module incorrectly references the moq-token binary as moq-token instead of moq-token-cli, causing preStart commands for auth key and cluster token generation to fail. Additionally, the cluster token generation lacks validation that the authentication key has been successfully generated, leading to potential failures if the key generation step fails.

rs/nix/modules/moq-relay.nix#L221-L234

https://github.com/kixelated/moq/blob/5812bd212a0a6465149878f1af53ac77f05e5fe2/rs/nix/modules/moq-relay.nix#L221-L234

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@kixelated
Copy link
Collaborator

Bug: Curl Command Change Causes Silent Failures

The curl command was changed from -fsSL to -s, removing the -f (fail on HTTP errors), -S (show errors), and -L (follow redirects) flags. This can lead to silent download failures when encountering HTTP errors (e.g., 404) or redirects, potentially resulting in incomplete or incorrect files being downloaded without an explicit error.

rs/justfile#L45-L46
Fix in CursorFix in Web

Bug: Flake Inputs Bypassed for Dependencies

Using builtins.getFlake to fetch fenix and naersk flakes bypasses flake inputs and the lock file. This causes impure network fetches during evaluation, leading to non-reproducible builds and version inconsistencies. These dependencies should be passed as inputs to the overlay function instead.

rs/nix/overlay.nix#L2-L4
Fix in CursorFix in Web

Bug: JWT Key Misconfiguration in Moq-Relay

When JWT authentication is enabled and services.moq-relay.auth.keyFile is null, the preStart script correctly generates a JWT signing key at cfg.stateDir/root.jwk. However, the generated moq-relay.toml configuration incorrectly sets auth.key to null, preventing the moq-relay service from using the generated key.

rs/nix/modules/moq-relay.nix#L27-L28
Fix in CursorFix in Web

Bug: Service Fails When Cluster URLs Are Null

The moq-relay service's ExecStart command incorrectly passes cfg.cluster.rootUrl and cfg.cluster.nodeUrl as the string "null" to their respective command-line arguments (--cluster-root, --cluster-node) when these options are null (their default). This results in invalid command line arguments.

rs/nix/modules/moq-relay.nix#L214-L217
Fix in CursorFix in Web

BugBot free trial expires on July 22, 2025 Learn more in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

FYI @gordysunsaronic I let Cursor fix these issues, but I don't have a way of validating the nixos fixes. Could you double check everything still runs?

@moq-bot moq-bot bot mentioned this pull request Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants