How to mirror a flake locally?

Hi, I’m trying to get the Zen-browser flake to work locally. By this I mean that I want to copy the contents of the flake in my nixos-config directory and refer to it in main flake.
I have the following folder tree:

pkgs
  zen
    flake.nix
    zen.desktop
flake.nix
flake.lock

Now i my main flake I do:

inputs = {
...
zen-browser = {
      url = "path:./pkgs/zen/";
      inputs.nixpkgs.follows = "nixpkgs";
};
...
}

but when I do rebuild switch I get this error:

error: builder for '/nix/store/07q96sqijbvcw1qpcayilhcamfypz72c-zen-browser-1.0.1-a.16.drv' failed with exit code 1;
       last 2 log lines:
       > Running phase: installPhase
       > install: cannot stat '/nix/store/d89x2f4s2zyg3za4y1h0q2ivhdjfp1dv-451s1z9y3c3jmzck61k0hbchbmvqhm10-source/zen.desktop': No such file or directory

When I just go in /pkgs/zen and do nix build .#specific it does work without issues.
Is my approach to this flawed?

Relative paths in flake inputs (subflakes) are just overall broken, don’t use them.
Use an absolute path if you must.

Fair enough, I was also thinking about just making a derivation of this, instead of a (sub)flake. Would that be better?

Seems easier and more effective, especially since the file is already within your flake.
But if you’re using git for the outer flake ensure to git-add the files.

1 Like

It took me a bit, but indeed, a derivation was the way to go. Thanks!