I have a simple systemd unit on an Almalinux system (where Nix was installed using the determinate systemd installer):
[Unit]
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=1
User=myuser
ExecStart=/my/path/to/executable
When I run /my/path/to/executable
with myuser
, that works fine. However, when I start the systemd unit, it tells me:
Failed at step EXEC spawning /my/path/to/executable: Permission denied
The first line of the executable is:
#! /nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash -e
When I change the unit to be:
ExecStart=bash /my/path/to/executable
It works fine. What could be the cause here?