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.
This commit is contained in:
1 parent
972f578584
commit
a1cefa75d1
1 file changed
+9
@@ -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
|
||||
''}";
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user