Help importing .nix files into flakes

Hi There

I am unable to import any config or .nix files into a flake. Ultimately, I am trying to manage my dotfiles via xdg.configFile. .... .source = modules/config.nix for example. However, when I run the flake to build the config I get

       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

for example, a line that I am trying to use to manage my alacritty .config: xdg.configFile."alacritty/alacritty.yaml".source = modules/alacritty.nix;

I have tried various other ways, using import in either the flake or home.nix file but wherever I put it I am getting the same error, it is as if flakes are unable to import any external .nix or conf files by design?

Have you tried setting it to ./modules/alacritty.nix?

1 Like

yeah I have tried that, I have also tried absolute paths, moving alacritty.nix to the current dir and just using alacritty.nix but no matter which way I do it I get the same error.

It’s probably that Flakes only includes Git-tracked files in the evaluation, so you need to git add the file before it can be used


Thanks for the reply, all files are added to git.

Can you produce an MRE or post your configuration?