nix.module: smaller issues in the NixOS module #61

Open
opened 2026-10-06 13:55:02 +00:00 by ffrauenberger · 1 comment
Owner

Severity: low (a list of small fixes; items 3 and 4 can stop evaluation or nginx on some hosts)

Where

  • module.nix

Problem

Collection of smaller problems in module.nix:

# Issue Line(s)
1 The cleanup script prints "Deleting tmp files in: $d", but $d is never set, so the log line is always empty. 255
2 The cleanup deletes only files (-type f), so session_* directories accumulate (#20). 256-259
3 domainNameAliases has no default, so it is mandatory although described as an optional alias list. Evaluation fails if it is not set. 118-123
4 access_log … json_analytics requires a log_format json_analytics that this module never defines, so nginx fails to start unless the host config defines it. 286-289
5 locations."/stream" targets the pre-1.18 Streamlit WebSocket path (current: /_stcore/stream). The block is dead config; the / location already proxies WebSockets. 300-304
6 self.packages.${pkgs.system} uses pkgs.system, deprecated in recent nixpkgs (use pkgs.stdenv.hostPlatform.system). 13
7 logLevel is a free-form str, so typos are accepted and only fail at runtime in Python logging config. Use types.enum. 110-116
8 No resource limits (MemoryMax, CPUQuota, TasksMax) on a service that runs user-controlled heavy computations (#31). 201-216
9 ExecStartPost polls for the socket with sleep 1 and 10 retries. On slow starts the unit fails although the app is fine. A systemd.socket unit or Type=notify would be more robust. 218-245

Steps to reproduce

(Item 3) Enable the module without setting domainNameAliases; evaluation fails.
(Item 4) Enable the module on a host that does not define log_format json_analytics; nginx fails to start.

Expected behavior

The module evaluates and nginx starts with only the documented required options set.

Actual behavior

See the table above.

Related: #20, #31.

Fix

Address each item individually as described in the table. Items 3, 4 and 8 have the most impact.


from issues/DEP-002-nixos-module-minor-issues.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** low (a list of small fixes; items 3 and 4 can stop evaluation or nginx on some hosts) ## Where - `module.nix` ## Problem Collection of smaller problems in `module.nix`: | # | Issue | Line(s) | |---|---|---| | 1 | The cleanup script prints `"Deleting tmp files in: $d"`, but `$d` is never set, so the log line is always empty. | 255 | | 2 | The cleanup deletes only files (`-type f`), so `session_*` directories accumulate (#20). | 256-259 | | 3 | `domainNameAliases` has no `default`, so it is mandatory although described as an optional alias list. Evaluation fails if it is not set. | 118-123 | | 4 | `access_log … json_analytics` requires a `log_format json_analytics` that this module never defines, so nginx fails to start unless the host config defines it. | 286-289 | | 5 | `locations."/stream"` targets the pre-1.18 Streamlit WebSocket path (current: `/_stcore/stream`). The block is dead config; the `/` location already proxies WebSockets. | 300-304 | | 6 | `self.packages.${pkgs.system}` uses `pkgs.system`, deprecated in recent nixpkgs (use `pkgs.stdenv.hostPlatform.system`). | 13 | | 7 | `logLevel` is a free-form `str`, so typos are accepted and only fail at runtime in Python logging config. Use `types.enum`. | 110-116 | | 8 | No resource limits (`MemoryMax`, `CPUQuota`, `TasksMax`) on a service that runs user-controlled heavy computations (#31). | 201-216 | | 9 | `ExecStartPost` polls for the socket with `sleep 1` and 10 retries. On slow starts the unit fails although the app is fine. A `systemd.socket` unit or `Type=notify` would be more robust. | 218-245 | ### Steps to reproduce (Item 3) Enable the module without setting `domainNameAliases`; evaluation fails. (Item 4) Enable the module on a host that does not define `log_format json_analytics`; nginx fails to start. ### Expected behavior The module evaluates and nginx starts with only the documented required options set. ### Actual behavior See the table above. Related: #20, #31. ## Fix Address each item individually as described in the table. Items 3, 4 and 8 have the most impact. --- from `issues/DEP-002-nixos-module-minor-issues.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

Reviewed by Codex (GPT-6) against origin/main 6bcc646eb464.

Review: partially correct.

Item 3 is refuted in the pinned Nix environment. I evaluated nixosSystem with this module enabled and only domainName='review.example' set, leaving domainNameAliases unset; services.nginx.virtualHosts."review.example".serverAliases evaluates successfully to []. The list option obtains its empty value through the module/type machinery, so the missing explicit default does not produce the claimed evaluation failure. An explicit default = [] can still improve clarity.

Item 9's suggested alternatives need prerequisites: Type=notify requires the application to send readiness notifications, and socket activation requires accepting an inherited listening descriptor. The current entrypoint only exposes host/port/socket-path options. Neither is a drop-in unit-only fix. The undefined $d, file-only cleanup, undeclared json_analytics, network/resource concerns and fragile polling remain supported.

Code references: module.nix:118, module.nix:218, module.nix:286.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** Item 3 is refuted in the pinned Nix environment. I evaluated `nixosSystem` with this module enabled and only `domainName='review.example'` set, leaving `domainNameAliases` unset; `services.nginx.virtualHosts."review.example".serverAliases` evaluates successfully to **`[]`**. The list option obtains its empty value through the module/type machinery, so the missing explicit `default` does not produce the claimed evaluation failure. An explicit `default = []` can still improve clarity. Item 9's suggested alternatives need prerequisites: `Type=notify` requires the application to send readiness notifications, and socket activation requires accepting an inherited listening descriptor. The current entrypoint only exposes host/port/socket-path options. Neither is a drop-in unit-only fix. The undefined `$d`, file-only cleanup, undeclared `json_analytics`, network/resource concerns and fragile polling remain supported. Code references: [module.nix:118](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/module.nix#L118), [module.nix:218](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/module.nix#L218), [module.nix:286](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/module.nix#L286).
Sign in to join this conversation.
No milestone
No assignees
1 participant
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
ffrauenberger/ProcessIntel#61
No description provided.