diff --git a/lib/types.nix b/lib/types.nix index c74248f..e80d8b1 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -10,70 +10,6 @@ (attrsOf anything) ]); - cosmicEntry = lib.types.submodule ( - { config, ... }: - { - options = { - value = lib.mkOption { - type = lib.types.cosmicEntryValue; - example = true; - description = '' - The value stored in the entry. - ''; - }; - __type = lib.mkOption { - type = - with lib.types; - nullOr (enum [ - "raw" - "option" - "char" - "map" - "tuple" - ]); - default = null; - example = "raw"; - description = '' - Internal type classification for cosmic entries. - - When `null`, the entry is treated as a simple value. - - Must not be used together with `__name`. - - The following types are supported: - - `raw`: The value is stored as-is. - - `option`: The value is stored as an optional value. (e.g. `Some(value)` or `None`). - - `char`: The value is stored as a single character. (e.g. `'a'`). - - `map`: The value is stored as a map. (e.g. `{ "key" = "value"; }`). - - `tuple`: The value is stored as a tuple. (e.g. `(1, 2, 3)`). - ''; - }; - __name = lib.mkOption { - type = with lib.types; nullOr str; - default = null; - example = "Config"; - description = '' - Identifier for named struct entries. - - When set, provides a label for the entry in structured data. - - Must not be used together with `__type`. - ''; - }; - }; - - config = { - _module.check = lib.mkIf (config.__type != null && config.__name != null) ( - throw "Cannot specify both type and name in cosmicEntry" - ); - }; - } - ); - - coercedCosmicEntry = - with lib.types; - coercedTo cosmicEntryValue (value: { inherit value; }) cosmicEntry; - cosmicComponent = lib.types.submodule { options = { version = lib.mkOption { @@ -86,7 +22,7 @@ }; entries = lib.mkOption { - type = with lib.types; attrsOf coercedCosmicEntry; + type = with lib.types; attrsOf cosmicEntryValue; default = { }; example = { autotile = true; diff --git a/modules/files.nix b/modules/files.nix index 3d4daa6..0df4f7e 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -234,6 +234,7 @@ lib.mapAttrsToList (component: details: { inherit component; inherit (details) version; + operation = "write"; xdg_directory = xdgDirectory; entries = builtins.mapAttrs ( @@ -261,7 +262,7 @@ ]; home = { - activation = lib.mkIf config.wayland.desktopManager.cosmic.enable { + activation = lib.mkIf cfg.enable { configure-cosmic = lib.hm.dag.entryAfter [ "writeBoundary" ] '' run ${lib.getExe cosmic-ctl} apply ${json} ''; @@ -277,7 +278,7 @@ ); }; - packages = [ cosmic-ctl ]; + packages = lib.optionals cfg.enable [ cosmic-ctl ]; }; }; }