Added a generator for the KDL document language.
This is in order for home-manager to natively generate
the new config format for zellij, as described in nix-community#3364.
There is not a one to one mapping between KDL and nix types,
but attrset translation is heavily based on KDLs JSON-IN-KDL microsyntax.
The exception here is the `_args` and `_props` arguments, which lets you
specify arguments and properties as described in the spec.
See more here:
- https://kdl.dev/
- https://github.com/kdl-org/kdl/blob/main/SPEC.md
The generator also conforms to the interface from the nixpkgs manual:
https://nixos.org/manual/nixpkgs/stable/#sec-generators
Co-authored-by: Gaetan Lepage <gaetan@glepage.com>
Specifically,
- directly export `modules/lib/dag.nix` instead of renaming
attributes,
- run through utilities to reuse code where possible,
- expose `lib.hm.dag.isEntry` and reuse it in
`modules/lib/types-dag.nix`,
- reuse utilities through `lib` set instead of passing imports to
functions, and
- eta reduction of `map`, `entryAnywhere`, `entryAfter` and
`entryBefore`.
Before, loading a module would be guarded by an optional platform
condition. This made it possible to avoid loading and evaluating a
module if it did not support the host platform.
Unfortunately, this made it impossible to share a single configuration
between GNU/Linux and Darwin hosts, which some wish to do.
This removes the conditional load and instead inserts host platform
assertions in the modules that are platform specific.
Fixes#1906
This change makes use of the `extend` function inside `lib` to inject
a new `hm` field containing the Home Manager library functions. This
simplifies use of the Home Manager library in the modules and reduces
the risk of accidental infinite recursion.
PR #994
In particular support source files whose name start with `.` or
contain characters not allowed in the nix store, such as spaces.
Also add some test cases for `home.file`.
Added utilities to generate export statements and definitions for zsh scripts.
Currently, there is only lib.shell which generates export statements in bash
syntax. However, this does not allow to generate export statements for zsh
arrays (syntax: NAME=(elem1 elem2 ...) ), which would be the natural
representation of lists in the nix language.