1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-05 02:39:45 +01:00
Commit graph

19 commits

Author SHA1 Message Date
Robert Helgesson
28614ed7a1
lib: add functions to create DAGs from lists 2023-06-05 23:08:30 +02:00
Robert Helgesson
79e03fbe24
lib: remove listOrDagOf type
It has been deprecated for a long time and should be safe to remove.
2023-06-05 23:08:29 +02:00
h7x4
fce9dbfeb4
lib: add generator for KDL
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>
2023-03-10 16:48:10 +01:00
Liam Petrie
864ff685fe
lib: add two new gvariant types
Add GVariant variant and dictionary entry types
2022-09-29 13:05:51 +02:00
Naïm Favier
6311f4adc3
lib/types: make DAG entries mergeable
Removes the `uniq` constraint on `after` and `before` so that we can
merge multiple definitions for the same DAG entry:

    {
      dag = mkMerge [
        {
          foo = lib.hm.dag.entryBefore [ "bar" ] {
            # definition 1
          };
        }
        {
          foo = lib.hm.dag.entryBefore [ "qux" ] {
            # definition 2
          };
        }
        {
          foo = {
            # definition 3
          };
        }
      ];
    }

In this example `foo` will come before `bar` and `qux`.
2022-07-12 11:47:38 +02:00
Naïm Favier
8db712a6a2
types: fix dagOf behaviour with mkIf
This makes definitions like

    home.activation.foo = mkIf false "bar"

work, where previously they would complain about
`home.activation.foobar.data` being used but not defined.

The crucial part is that we don't call `convertAllToDags` in
`dagOf.merge`, because we need to process `mkIf`/`mkMerge` properties
first. So we let `attrEquivalent.merge` do its job normally, but give
it a type `dagEntryOf` that does the conversion.

Ideally this shouldn't require so much boilerplate; I'd like to
implement something like

    types.changeInto dagContentType elemType dagEntryAnywhere

in Nixpkgs.
2022-03-30 23:29:09 +02:00
Thiago Kenji Okada
3ccddfc48d
lib: remove top-level with lib 2021-10-31 08:50:53 +01:00
Robert Helgesson
a965b097b1
lib.gvariant: fix rendering of empty non-string arrays
Before, empty arrays would always be rendered as an empty string
array.
2021-08-13 08:52:13 +02:00
Robert Helgesson
a3d691c053
lib.gvariant: add a few more functions to test case 2021-08-13 00:45:10 +02:00
Robert Helgesson
604561ba9a
lib.gvariant: escape newlines in strings
See #2096
2021-08-11 23:30:24 +02:00
Robert Helgesson
e42e147b58
Remove some usage of config.lib.dag
The `lib.hm.dag` attribute set should always be preferred.
2021-05-09 12:13:31 +02:00
Symphorien Gibol
e1fbb74b41
lib.gvariant: escape backslashes in strings
PR #1433
2020-08-12 22:53:28 +02:00
Robert Helgesson
83301ca787
lib: support gvariant maybe type
Fixes #1397
2020-07-24 16:45:13 +02:00
Robert Helgesson
8ad4bd6c1b
types: improve dagOf and listOrDagOf
In particular, improve the behavior of these types if the element type
is a submodule.
2020-04-13 22:01:20 +02:00
Robert Helgesson
ac9e44a831
lib: add GVariant datatype and functions 2020-03-21 00:28:50 +01:00
Robert Helgesson
45abf3d38a
Apply nixfmt on many files 2020-02-02 01:07:28 +01:00
Robert Helgesson
1397570eea
tests: use lib.hm.types instead of explicit import 2020-01-26 11:28:34 +01:00
Robert Helgesson
7f87329fca
home-environment: use DAG type in activation option 2020-01-16 00:16:35 +01:00
Robert Helgesson
6c127efb2d
lib: add type generators dagOf and listOrDagOf
Given an inner type, the former function generates a type that expect
DAG option values. The latter function is only present to temporarily
allow the `programs.ssh.matchBlocks` to keep accepting list values.
2020-01-16 00:16:09 +01:00