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 ''}"; };