When running stack on a NixOS laptop, I require
nix:
enable: true
in my stack.yaml for it to work.
Problem: When I run stack within a project on a non-NixOS laptop, this generates an error.
Question: Is there a way for stack.yaml to conditionally enable nix if and only if you are running NixOS?
The
stack.yamlfile can not contain the logic you're requesting, but you can solve the problem by moving it into the user-specific or machine-specific config files,~/.stack/config.yamlor/etc/stack/config.yaml:This will then be the default on your machine/user, so you can leave out the
nix/enableflag from the project-specificstack.yaml.