nix-community / haumea

Filesystem-based module system for Nix [maintainer=@figsoda]
https://nix-community.github.io/haumea/
Mozilla Public License 2.0
289 stars 5 forks source link

Move comments to the code #38

Open teto opened 7 months ago

teto commented 7 months ago

I feel similarly to https://discourse.nixos.org/t/haumea-filesystem-based-module-system-for-nix/26902/15, aka I have trouble making sense of the documentation. I find the readme great but the git book useless. I had to look at @figsoda 's dotfiles to see how to use it.

I cloned the repo to get a better understanding and was surprised to see that the comments exist in the doc book but not in the code. Moving the doc to src/load.nix the doc for the load function with what it expects as input would help greatly IMO.

teto commented 6 months ago

while I like the idea of the project I find that it generates obscure error messages and it's hard to track down where it goes wrong: for instance

unionOfDisjoint: collision on programs; complete list: programs

       … while calling 'pushDownProperties'
         at /nix/store/5w6rhfakgdj3ydq7h0divdrxa7x0hr1b-source/lib/modules.nix:876:24:
          875|   */
          876|   pushDownProperties = cfg:
             |                        ^
          877|     if cfg._type or "" == "merge" then

       … from call site
         at /nix/store/5w6rhfakgdj3ydq7h0divdrxa7x0hr1b-source/lib/modules.nix:877:8:
          876|   pushDownProperties = cfg:
          877|     if cfg._type or "" == "merge" then
             |        ^
          878|       concatMap pushDownProperties cfg.contents

       … while calling anonymous lambda
         at /nix/store/5w6rhfakgdj3ydq7h0divdrxa7x0hr1b-source/lib/attrsets.nix:1197:39:
         1196|       collisions = lib.concatStringsSep " " (builtins.attrNames intersection);
         1197|       mask = builtins.mapAttrs (name: value: builtins.throw
             |                                       ^
         1198|         "unionOfDisjoint: collision on ${name}; complete list: ${collisions}")

       error: unionOfDisjoint: collision on programs; complete list: programs