Is it possible to use git submodules with flakes?

My use case is that I import my private stuff only if the file exists to exclude that from my public nix config.

I use (if builtins.pathExists ../../secrets/at_home.nix then [ ../../secrets/at_home.nix ] else [ ]) for the import.

The problem seems to be that those files are excluded no matter what when I’m using flakes.

Is there a way around that?

1 Like

The only way I found (thanks to help from the irc channel):

imports = [
# some stuff
] ++ (if builtins.pathExists (builtins.getEnv "PWD" + "/secrets/at_home.nix") then [ (builtins.getEnv "PWD" + "/secrets/at_home.nix") ] else [ ]);

and build with --impure.