Before this commit, there existed slight confusion between the directory
name and the library scope name. For example, `lib.points.fix` is
defined in `points/default.nix` under an attribute set named `points`.
Theoretically, one could create a new directory, such as `foo`, but name
the library scope `bar`.
With this commit, the library scope is inferred from dirname
automatically. This also has the benefit of slightly reducing nesting
and reducing duplication of data. As a downside, it turns `files`, a
list of paths, into a list of strings. This is necessary because when
paths are parsed in NixLang, they become absolute paths, and so
`builtins.toString ./lists` would become "/home/foo/lib/src/lists",
which is undesirable. This is a downside, because it makes using
filepath LSP (like the one Neovim usually ships with, where it provides
autocomplete for paths) impossible, and so typos become a little easier
to make.
This is necessary for future work on migrating to RFC 145 style
doc-comments. This migration would allow us to build API documentation,
but first, the nesting needs to be removed, because `nixdoc` (an utility
to build Markdown out of doc-comments) doesn't expect it and generates
empty entries.
In I605b034fdfc537e84785ce5149e443f54e5d4e3a, we removed some
requirements for merging types - we should write some tests to make sure
that (1) they all work and (2) future updates can't break our merging
again
The type merging code is too restrictive - a bug - since as some types
that specify defaults can't be merged at all even if they should be able
to.
I've made the merging system to allow merging if any of the following
apply:
- Unmergeable properties are unspecified on one side
- Unmergeable properties have different priorities, in which case we
will take the more important priority - this allows overrides
- Unmergeable properties are the same on both sides, for example this
lets us specify everything at default priorities and have them merged
Merging each of the problem properties manually also lets us pinpoint
what the issue is and merge them in a nicer way
Change-Id: I605b034fdfc537e84785ce5149e443f54e5d4e3a
We're about to add overriding to make it so we can merge more things in
modules. Before using any of these things (although after merging), we
need to strip out the overrides
We can hijack the modules.apply.fixup function to do this, as it is
called in places where things are merged