There’s dedicated build helpers to make scripts, I’d use one of those. (Usually writeShellApplication
since I don’t trust bash.)
https://nixos.org/manual/nixpkgs/unstable/#chap-trivial-builders
I also prefer not to hardcode paths if possible, but I don’t exactly see where the wrapper is defined… If you’ve defined the wrapper in your own config, then ${config.security.wrapperDir}/${config.security.wrappers.restic.program}
should work to build the absolute path string.
Also, the NixOS restic module should be using getExe
, not hardcoding /bin/restic
…