Commit graph

15 commits

Author SHA1 Message Date
Vincent Ambo
a65cb50252 fix: Various minor fixes for new repository layout 2019-12-20 20:44:00 +00:00
Vincent Ambo
467a66bac2 feat(readTree): Add support for skipping directory subtrees
Placing a special `.skip-subtree` file in any directory will now
prevent readTree from further traversing that part of the tree.

This makes it possible to have packages with internal Nix files that
are incompatible with the larger depot structure, for example for
projects like buildGo.nix which need to be compatible with the
external nixpkgs model.
2019-12-19 15:33:30 +00:00
Vincent Ambo
050b3aabaf fix(read-tree): Only add marker to imported attribute sets
Sometimes things that get imported are (intentionally) not attribute
sets, e.g. for build functions.

Those should not be merged with the marker because, well, that's not
possible.
2019-12-10 14:46:05 +00:00
Vincent Ambo
da64d852ea refactor(read-tree): Simplify tree recursion logic
Rewrites the previous initial tick-tocking recursion into a more
straightforward style.

Every attribute set that is imported by readTree now also contains an
attribute called `__readTree` set to `true` which acts as a marker for
other types of tree traversals.

Unfortunately directories without any children or importable content
still result in empty attribute sets, but overall this might be the
better tradeoff vs. having to follow the recursion all the way at each
subtree level to determine which children exist.
2019-12-09 23:23:13 +00:00
Vincent Ambo
2b6b76570e feat(read-tree): Mark derivations that have children
Adds a `__treeChildren` attribute that is set to `true` on derivations
that have children, e.g. for cases where a folder contains a
`default.nix` but has subdirectories with additional things in them.
2019-12-09 19:51:15 +00:00
Vincent Ambo
124e185628 fix(read-tree): Always import with locatedAt attribute 2019-12-09 12:22:33 +00:00
Vincent Ambo
e9431682b2 refactor: Move CI setup to separate Nix file
Instead of polluting the repository namespace with the list of CI
projects, move that to a separate file.

Currently the list of projects to be built by CI is still hardcoded,
but this will be fixed soon.
2019-12-09 10:58:09 +00:00
Vincent Ambo
ff38ae6c5f fix(read-tree): Don't import default.nix sibling expression
If a folder contains a `default.nix`, Nix expressions contained in
adjacent files should not be imported (they might be things like a
`shell.nix` or a `deps.nix` which do not evaluate to derivations).

The tree traversal still continues for all children folders of a
folder with a `default.nix`.
2019-12-09 03:16:02 +00:00
Vincent Ambo
01bad09eed refactor: Introduce new layout with nixpkgs in third_party
This is not the final layout yet, but makes it so that my top-level
attribute set is no longer overlaid into nixpkgs itself.

This is useful for other people who are importing my monorepo.
2019-12-09 02:40:48 +00:00
Vincent Ambo
608a560ee8 refactor(read-tree): Remove deprecated 'builtins.toPath' call 2019-12-09 02:19:44 +00:00
Vincent Ambo
d23716f354 refactor(read-tree): Keep traversing even if a default.nix is found
This makes it possible for people to drop a default.nix into folders
along the way that add additional things into the attribute set at
that level.

These default.nix files are imported and merged with the rest of the
traversal from that point on. In theory nothing stops a user from
putting a derivation into one of them, but the effects of merging that
derivation's underlying attribute set with random other things from
the traversal are undefined.

This feature is being introduced for a slight revamp of the thirdParty
layout.
2019-12-02 15:05:54 +00:00
Vincent Ambo
43f91c44bd feat(read-tree): Pass in-tree location to imported package sets
Passes the location from the root at which packages are imported on to
all packages.

The path is passed in as a parameter called 'locatedAt' which contains
a list of strings with each individual path component.

For example, the blog source in `services/tazblog` will have a list
with `[ "services" "tazblog" ]` passed in as the `locatedAt`
attribute.

This can be used for enabling features such as path-specific imports
when using things like buildGo.
2019-11-25 15:32:02 +00:00
Vincent Ambo
48ed487bdd refactor(read-tree): Idiomatic 'attrsToList' instead of weird hack 2019-11-25 15:10:31 +00:00
Vincent Ambo
c1c379848a chore(nix): Move files around to conform to new read-tree layout
Broadly speaking, the following things are included:

* there is now a uniform `args` struct that is passed to all
  derivations, package headers have been changed appropriately
* overrides are now loaded from a separate `override` folder just
  using read-tree.nix
* third-party packages have moved into the `third_party` attribute set
2019-11-15 15:26:08 +00:00
Vincent Ambo
4d852e2ef7 feat(build): Add initial read-tree.nix implementation
This file can read a directory tree into a package set structure,
paving the way for getting rid of top-level mapping in default.nix.
2019-11-15 14:52:23 +00:00