I’m trying to write a script in nix, which by itself is cursed, but with
builtins.readFile i should be able to do some stuff that is scrip-like.
So i was wondering if it was possible to read environment variables or execute shell commands at evaluation time in nix code. After all, some nix commands can be altered with shell variables (like $NIXPKGS_ALLOW_UNFREE), sometimes only when passing the
--impure flag. But i guess that is done within the c++ code of nix?
Any workaround ideas? Otherwise, I would have to write nix code that generates shell script code, which is not ideal, i’d say.