From a1cefa75d1f75409b28b13553afb10014ab1e157 Mon Sep 17 00:00:00 2001 From: OmO Orchestrator Date: Fri, 20 Nov 2026 23:48:10 -0500 Subject: [PATCH] fix(flake): explicitly put openssl on PATH for nix run 'nix run' threw 'spawnSync openssl ENOENT' on the real NixOS target even though openssl is installed there system-wide - nix run's environment doesn't carry ambient host PATH entries like /usr/bin, only what the flake explicitly provides. run-local.mjs shells out to openssl to generate its HTTPS cert, so pkgs.openssl now gets explicitly prefixed onto PATH in the apps.default wrapper script, guaranteeing it's reachable regardless of host state - the actual Nix-idiomatic fix, not a hope that a system binary happens to be on PATH. Verified via the real flake: nix build succeeded, and nix run fetched openssl-3.5.9-bin from cache.nixos.org specifically because of this reference (proof it is a real, explicit dependency now), then served HTTPS successfully with a real generated cert. --- flake.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flake.nix b/flake.nix index 677cc0a..8ceea74 100644 --- a/flake.nix +++ b/flake.nix @@ -83,7 +83,16 @@ # only the SQLite files under ./.data survive the process exiting. apps.default = { type = "app"; + # `nix run`'s environment carries only what the flake explicitly + # puts on PATH - NOT ambient system binaries like a host's + # /usr/bin/openssl (confirmed: this threw `spawnSync openssl + # ENOENT` on the real NixOS target even though openssl is + # installed system-wide there - nix run's PATH simply never saw + # it). run-local.mjs shells out to openssl to generate its + # self-signed HTTPS cert, so it must be explicitly prefixed onto + # PATH here, not assumed to already be reachable. program = "${pkgs.writeShellScript "commons-run" '' + export PATH="${pkgs.openssl}/bin:$PATH" exec ${nodejs}/bin/node ${commons}/scripts/run-local.mjs ''}"; };