bug: Reference docs disagree with NixOS service settings on global port. #2431

Open
opened 2026-10-31 01:18:37 +00:00 by tetraketra · 4 comments

What is the bug?

https://continuwuity.org/reference/config.html

The port(s) continuwuity will listen on.

For reverse proxying, see:
https://continuwuity.org/deploying/generic.html#setting-up-the-reverse-proxy
If you are using Docker, don't change this, you'll need to map an
external port to this.

To listen on multiple ports, specify a vector e.g. [8080, 8448]

env: CONTINUWUITY_PORT
port = 8008

This suggests the port can be a single number.


https://search.nixos.org/options?channel=26.05&query=services.matrix-continuwuity.settings.global.port&type=options

Type: list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)
configuration.nix:

{
  services.matrix-continuwuity.settings.global.port = [
    6167
  ];
}

On both 26.05 and unstable, the port setting must always be a list.


Update the reference docs to match the service, or update the service to match the docs. Best is probably updating the NixOS settings to types.either (listOf (port)) port and making it work as a port.

Steps to reproduce

  1. Visit the 1st link.
  2. Visit the 2nd link.
  3. Observe the disagreement.

Server name and version

N/A

Additional context

No response

### What is the bug? https://continuwuity.org/reference/config.html > The port(s) continuwuity will listen on. > > For reverse proxying, see: > https://continuwuity.org/deploying/generic.html#setting-up-the-reverse-proxy > If you are using Docker, don't change this, you'll need to map an > external port to this. > > To listen on multiple ports, specify a vector e.g. [8080, 8448] > > env: CONTINUWUITY_PORT > port = 8008 This suggests the port can be a single number. --- https://search.nixos.org/options?channel=26.05&query=services.matrix-continuwuity.settings.global.port&type=options > Type: list of 16 bit unsigned integer; between 0 and 65535 (both inclusive) > configuration.nix: > ``` > { > services.matrix-continuwuity.settings.global.port = [ > 6167 > ]; > } > ``` On both `26.05` and `unstable`, the `port` setting must _always_ be a list. --- Update the reference docs to match the service, or update the service to match the docs. Best is probably updating the NixOS settings to `types.either (listOf (port)) port` and making it work as a `port`. ### Steps to reproduce 1. Visit the 1st link. 2. Visit the 2nd link. 3. Observe the disagreement. ### Server name and version N/A ### Additional context _No response_
Owner

I don't know how nix packaging works, but the port param is a union type, it can either be a vec of u16s, or just a u16 outright (which is basically equivalent to a vec of them consisting of a single entry). I assume there may be an issue representing that type in the nix thingy or something?

I don't know how nix packaging works, but the `port` param is a union type, it can either be a vec of u16s, or just a u16 outright (which is basically equivalent to a vec of them consisting of a single entry). I assume there may be an issue representing that type in the nix thingy or something?
Author

If it's a union type from where you see, there may be a validation issue:
Otherwise yes, it's a Nix something-something probably.

tetraketra@tetra-linux:~/Documents/Forgejo/nixos-config$ just build-toplevel homelab
nix build -L '.#nixosConfigurations.homelab.config.system.build.toplevel'
warning: Git tree '/home/tetraketra/Documents/Forgejo/nixos-config' is dirty
error:
       … while calling the 'head' builtin
         at «github:nixos/nixpkgs/b6018f87da91d19d0ab4cf979885689b469cdd41?narHash=sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI%3D»/lib/attrsets.nix:1696:13:
         1695|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1696|             head values
             |             ^
         1697|           else

       … while evaluating the attribute 'value'
         at «github:nixos/nixpkgs/b6018f87da91d19d0ab4cf979885689b469cdd41?narHash=sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI%3D»/lib/modules.nix:1118:7:
         1117|     // {
         1118|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1119|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/4k79ns9drp02wyvcix81c7nnz4hn8psi-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `services.matrix-continuwuity.settings.global.port':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: A definition for option `services.matrix-continuwuity.settings.global.port' is not of type `list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)'. TypeError: Definition values:
       - In `/nix/store/bs6icbk2bi5wznsjjpynia099hgv0g5k-source/nixos/homelab/configuration.nix': 8008
error: recipe `build-toplevel` failed on line 6 with exit code 1
If it's a union type from where you see, there may be a validation issue: Otherwise yes, it's a Nix something-something probably. ```nix tetraketra@tetra-linux:~/Documents/Forgejo/nixos-config$ just build-toplevel homelab nix build -L '.#nixosConfigurations.homelab.config.system.build.toplevel' warning: Git tree '/home/tetraketra/Documents/Forgejo/nixos-config' is dirty error: … while calling the 'head' builtin at «github:nixos/nixpkgs/b6018f87da91d19d0ab4cf979885689b469cdd41?narHash=sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI%3D»/lib/attrsets.nix:1696:13: 1695| if length values == 1 || pred here (elemAt values 1) (head values) then 1696| head values | ^ 1697| else … while evaluating the attribute 'value' at «github:nixos/nixpkgs/b6018f87da91d19d0ab4cf979885689b469cdd41?narHash=sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI%3D»/lib/modules.nix:1118:7: 1117| // { 1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value; | ^ 1119| inherit (res.defsFinal') highestPrio; … while evaluating the option `system.build.toplevel': … while evaluating definitions from `/nix/store/4k79ns9drp02wyvcix81c7nnz4hn8psi-source/nixos/modules/system/activation/top-level.nix': … while evaluating the option `services.matrix-continuwuity.settings.global.port': (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: A definition for option `services.matrix-continuwuity.settings.global.port' is not of type `list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)'. TypeError: Definition values: - In `/nix/store/bs6icbk2bi5wznsjjpynia099hgv0g5k-source/nixos/homelab/configuration.nix': 8008 error: recipe `build-toplevel` failed on line 6 with exit code 1 ```
Owner

Yeah no idea what's going on there, but in the config definition it's definitely a union:

Lines 2564 to 2569 in cb27a20
#[derive(Deserialize, Clone, Debug)]
#[serde(transparent)]
struct ListeningPort {
#[serde(with = "either::serde_untagged")]
ports: Either<u16, Vec<u16>>,
}

@Henry-Hiles I hate to cold mention but I recall you having contributed to the nix stuff before, would you happen to know what needs changing?

Yeah no idea what's going on there, but in the config definition it's definitely a union: https://forgejo.ellis.link/continuwuation/continuwuity/src/commit/cb27a2082d199eec5d7ebc82ce53e0ab4dc23e3d/src/core/config/mod.rs#L2564-L2569 @Henry-Hiles I hate to cold mention but I recall you having contributed to the nix stuff before, would you happen to know what needs changing?
Member

@Henry-Hiles I hate to cold mention but I recall you having contributed to the nix stuff before, would you happen to know what needs changing?

No worries, I don't mind mentions :)

This is more Bart's are than mine, as it's nixpkgs, not the flake, but I'd guess the type just needs changing in the module to use types.either, like @tetraketra mentioned in the original post.

C.C. @Bart

> @Henry-Hiles I hate to cold mention but I recall you having contributed to the nix stuff before, would you happen to know what needs changing? No worries, I don't mind mentions :) This is more Bart's are than mine, as it's nixpkgs, not the flake, but I'd guess the type just needs changing in the module to use `types.either`, like @tetraketra mentioned in the original post. C.C. @Bart
Sign in to join this conversation.
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
continuwuation/continuwuity#2431
No description provided.