diff --git a/lib/combinators/try-fwd-env.nix b/lib/combinators/try-fwd-env.nix index eba6250..c592ac1 100644 --- a/lib/combinators/try-fwd-env.nix +++ b/lib/combinators/try-fwd-env.nix @@ -1,11 +1,19 @@ -{ combinators, helpers, ... }: +{ + combinators, + helpers, + pkgs, + ... +}: let - inherit (combinators) set-env; + inherit (combinators) unsafe-add-raw-args; in { sig = "String -> Permission"; doc = '' Forwards the specified environment variable to the underlying process (if set). ''; - impl = name: set-env name (helpers.noescape "\"\${${name}-}\""); + impl = + name: + assert pkgs.lib.isValidPosixName name; + unsafe-add-raw-args "\${${name}+--setenv ${name} \"\${${name}}\"}"; }