Flake in git repo can't find relative path

Hi!

I’m struggling with setting dwm on Nixos because my flake.nix file fails to find my dwm config folder. The weird thing here is that I don’t get any errors if I’m not tracking my configuration with git but I do when I add all my changes to a git repo inside the same folder my flake lives in.

What’s important to note here is that I have to clone dwm repo to set it up on my laptop (it’s the way dwm works), meaning that tracking my whole configuration implies adding my dwm folder as a submodule.

Folder structure:

  • waves-dotfiles
    • config
      • dwm
    • configuration.nix
    • flake.nix
    • home.nix

config.nix

services.xserver = {
   windowManager.dwm = {
      enable = true;
       package = pkgs.dwm.overrideAttrs{
           src=./config/dwm;
      };
   };
};

error: path '/nix/store/ahashcode-souce/config/dwm' does not exist

Does anyone know what I’m missing/doing wrong?

Nix can only see git-tracked files inside a flake that’s a git repo. git add -N the files at minimum in order for nix to see them.

Also, I’ll add that submodules + nix is a fairly unpleasant time, in general. And typically unnecessary. You can just reference the files from a flake input instead.

3 Likes

Thanks for your answer! It helped me to find out that the problem was the submodule. Luckily, I’m not pushing to dwm repository so I simply deleted its .git folder and voilá, all sorted.