Issue: write-npins fails on macOS due to GNU mktemp incompatibility
Description
The write-npins script is currently broken on macOS (and other BSD-based systems) because it relies on the GNU-specific --suffix flag for mktemp. The native BSD mktemp utility on macOS does not recognize this option, causing the script to crash.
Error Output
mktemp: unrecognized option `--suffix=.nix'
usage: mktemp [-d] [-p tmpdir] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-p tmpdir] [-q] [-u] -t prefix
Root Cause
The script uses writeShellApplication but does not guarantee that the GNU version of mktemp (from coreutils) is used over the host's system path. On macOS, /usr/bin/mktemp (BSD) often takes precedence or is called instead of the Nix-provided one if not explicitly handled.
Expected Behavior
The script should be hermetic and use the GNU mktemp from the Nix store to ensure consistent behavior across all platforms (Linux/Darwin).
Suggested Fix
In the writeShellApplication definition for write-npins:
- Ensure coreutils is present in runtimeInputs.
- Hardcode the path to mktemp using ${coreutils}/bin/mktemp inside the script text to avoid picking up the host's BSD version.
- Alternatively, use a portable mktemp syntax that works on both versions (e.g., mktemp /tmp/npins.XXXXXXXX.nix).
Issue:
write-npinsfails on macOS due to GNUmktempincompatibilityDescription
The
write-npinsscript is currently broken on macOS (and other BSD-based systems) because it relies on the GNU-specific--suffixflag formktemp. The native BSDmktemputility on macOS does not recognize this option, causing the script to crash.Error Output
Root Cause
The script uses writeShellApplication but does not guarantee that the GNU version of mktemp (from coreutils) is used over the host's system path. On macOS, /usr/bin/mktemp (BSD) often takes precedence or is called instead of the Nix-provided one if not explicitly handled.
Expected Behavior
The script should be hermetic and use the GNU mktemp from the Nix store to ensure consistent behavior across all platforms (Linux/Darwin).
Suggested Fix
In the writeShellApplication definition for write-npins: