ntfy-sh: fix sh not found in subscribe command

ntfy's CLI supports running a command for every incoming message via:

    ntfy subscribe TOPIC COMMAND

See: https://docs.ntfy.sh/subscribe/cli/#run-command-for-every-message

The upstream source hardcodes `sh` as the script launcher in
`cmd/subscribe_unix.go` and `cmd/subscribe_darwin.go`:

```go
scriptLauncher = []string{"sh", "-c"}
```

On NixOS, `sh` is not available in $PATH, causing command execution
to fail with:

    Command failed: exec: "sh": executable file not found in $PATH

Replace the hardcoded `sh` with nixpkgs' runtimeShell, which resolves
to the system's configured shell (typically bash).
This commit is contained in:
Jakob Lechner
2026-05-06 15:46:36 +02:00
parent 169fe20ef5
commit 60bf958aea
+7
View File
@@ -8,6 +8,7 @@
mkdocs,
python3,
python3Packages,
runtimeShell,
}:
buildGoModule (
@@ -71,6 +72,12 @@ buildGoModule (
postPatch = ''
sed -i 's# /bin/echo# echo#' Makefile
substituteInPlace \
cmd/subscribe_unix.go \
cmd/subscribe_darwin.go \
--replace \
'scriptLauncher = []string{"sh", "-c"}' \
'scriptLauncher = []string{"${runtimeShell}", "-c"}'
'';
preBuild = ''