morph icon indicating copy to clipboard operation
morph copied to clipboard

Error when building system, caused by extraModuleSources

Open NomAnor opened this issue 1 year ago • 0 comments

I'm trying to build a nixos system on my Arch Linux machine. I installed morph with nix-env -iA nixpkgs.morph.

When I run morph build network.nix, I get this error message:

The manual appears to depend on the location of Nixpkgs, which is bad since this prevents sharing via the NixOS channel. This is typically caused by an option default that refers to a relative path (see above for hints about the offending path). error: builder for '/nix/store/1p1mknzr1iyfbq6sazcwys8id8zqmxwn-options-docbook.xml.drv' failed with exit code 1;

What I could figure out is, that it is caused by https://github.com/DBCDK/morph/blob/ef1ad109bfef74f9fd56155da54fac98d04118dc/data/eval-machines.nix#L25

On my system this results in prefixesToStrip = [ "/nix/store/vffx27l0k6hgylbcm693w8004i7pm199-nixpkgs-23.05/nixpkgs/" "/nix/store/" ] in https://github.com/NixOS/nixpkgs/blob/6da4bc6cb07cba1b8e53d139cbf1d2fb8061d967/nixos/doc/manual/default.nix#L32-L33

The stripAnyPrefixes function then applies the list form the back stripping the /nix/store prefix and leaving the rest of the store path, which then triggers the error from above. Setting extraModuleSources to the empty list in my module resolves the issue.

I'm not sure if the part in eval-machines.nix is necessary or if it is an oversight that parent prefixes might not be handled in the correct order.

NomAnor avatar Jul 23 '23 13:07 NomAnor