From d35d5aded576cc7e0db77d4291eb09c3b26bffa9 Mon Sep 17 00:00:00 2001 From: alfarel Date: Thu, 16 Oct 2025 23:24:10 +0000 Subject: [PATCH] lib: split inherits for dag types to match repo style --- lib/types/dag.nix | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/types/dag.nix b/lib/types/dag.nix index e1615f1e..901f8868 100644 --- a/lib/types/dag.nix +++ b/lib/types/dag.nix @@ -1,34 +1,31 @@ # From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/types-dag.nix # Used for ordering configuration text. -{lib, ...}: let - # TODO: inherit from subgroups - inherit - (lib) - defaultFunctor - nvim - mkIf - mkOrder - mkOption - mkOptionType - types - ; +{ + lib, + nvf-lib, + ... +}: let + inherit (lib.types) attrsOf defaultFunctor listOf mkOptionType str submodule; + inherit (lib.modules) mkIf mkOrder; + inherit (lib.options) mkOption; + inherit (nvf-lib.dag) isEntry entryAnywhere; dagEntryOf = elemType: let - submoduleType = types.submodule ({name, ...}: { + submoduleType = submodule ({name, ...}: { options = { data = mkOption {type = elemType;}; - after = mkOption {type = with types; listOf str;}; - before = mkOption {type = with types; listOf str;}; + after = mkOption {type = listOf str;}; + before = mkOption {type = listOf str;}; }; config = mkIf (elemType.name == "submodule") { data._module.args.dagName = name; }; }); maybeConvert = def: - if nvim.dag.isEntry def.value + if isEntry def.value then def.value else - nvim.dag.entryAnywhere ( + entryAnywhere ( if def ? priority then mkOrder def.priority def.value else def.value @@ -54,7 +51,7 @@ in rec { # "actual" attribute name a new submodule argument is provided with # the name `dagName`. dagOf = elemType: let - attrEquivalent = types.attrsOf (dagEntryOf elemType); + attrEquivalent = attrsOf (dagEntryOf elemType); in mkOptionType rec { name = "dagOf";