I'm using stack with nix. I need to pass the environment variable as DB password to connect to Postgres while runtime. Currently, I enabled nix in the YAML and customized my own .nix
to put the password in .nix
.
stack.yaml:
nix:
enable: true
pure: true
shell-file: shell.nix
shell.nix:
{ghc}:
with (import <nixpkgs> {});
haskell.lib.buildStackProject {
inherit ghc;
name = "myenv";
buildInputs = [ postgresql_10 ];
PGPASSWORD = "pw";
}
But when I want to commit the code into GitHub/Gitlab and go to CI/CD pipeline, explicit the password in .nix
seems not good. I'd like to know is there a good way to deal with this?