Hey bubble, what tools do you know for substituting environment variables in files apart from `envsubst`?

I remember a tool that uses the `@VAR@ syntax but cannot remember its name.

@schmittlauch I think it's somewhere in nixpkgs, I've seen that format being used there:
nixpkgs/pkgs/build-support/bintools-wrapper]$ rg signingUtils
19:, postLinkSignHook ? null, signingUtils ? null
351: export signingUtils=${signingUtils}
11:source @signingUtils@

@tokudan Yeah, I found that its used by the substitute nixpkgs helper functions. Unfortunately they're only available as a setupHook, not standalone.

@mic92 AFAIK it replaces each occurence of $ANY_EXISTING_ENV_VAR without the possibility of escaping. That sometimes replaces too much.
I was planning to use it on a LaTeX document. Fortunately I managed to retrieve CLI args from Lua instead.

@schmittlauch a normal template engine and a scripting language might also help.

@mic92 I'd love if the nixpkgs substitute hooks were available as standalone commands.

@schmittlauch well there is nothing stopping your from sourcing the setup hook from stdenv in a normal shell script.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!