@Atemu, I need to use the value in my custom shell script. This seems to mean I need to ask nix to generate my shell script. Thanks for the tip though, I didn’t know runCommand accepts env vars.
Not per-se, it depends on how you use the shell script. You have the option of creating an environment file for something launched with systemd, or using a wrapper to set up the environment before the script runs.
So if you’d rather avoid hard-coding things with nix, it would be helpful if you could elaborate at least on how you will be using the script.
it would be helpful if you could elaborate at least on how you will be using the script.
I’m writing a script to help me install nixos. I need to extract the path value (relative to user’s home folder) of my nixos-config folder, to determine where to copy nixos-config to my new machine. Since nixos won’t exist yet in this use case, using lib.strings.toShellVars should be the correct solution?
Thanks for the suggestion. I should’ve made my use case clear in my OP.