diff --git a/lib/modules/programs/git.nix b/lib/modules/programs/git.nix index ac18d1e7..eb2b1ed6 100644 --- a/lib/modules/programs/git.nix +++ b/lib/modules/programs/git.nix @@ -1,41 +1,35 @@ { lib, ... }: let - inherit (lib) mkOption types; + inherit (lib) mkEnableOption mkOption types; - gitType = types.submodule ({ ... }: { - options = { - defaultBranch = mkOption { + gitOption = { + enable = mkEnableOption "git"; + + defaultBranch = mkOption { + type = types.nullOr types.str; + description = "The name of the default branch in newly created repositories."; + default = null; + }; + + flow = { + mainBranch = mkOption { type = types.nullOr types.str; - description = "The name of the default branch in newly created repositories."; + description = "The name of the stable branch in git flow."; default = null; }; - flow = { - mainBranch = mkOption { - type = types.nullOr types.str; - description = "The name of the stable branch in git flow."; - default = null; - }; - - devBranch = mkOption { - type = types.nullOr types.str; - description = "The name of the development branch in git flow."; - default = null; - }; - }; - - aliases = mkOption { - type = types.attrsOf types.str; - description = "The git command aliases to install."; - default = { }; + devBranch = mkOption { + type = types.nullOr types.str; + description = "The name of the development branch in git flow."; + default = null; }; }; - }); - gitOption = mkOption { - type = gitType; - description = "The git related options."; - default = { }; + aliases = mkOption { + type = types.attrsOf types.str; + description = "The git command aliases to install."; + default = { }; + }; }; in { options = { diff --git a/lib/modules/programs/nextcloud.nix b/lib/modules/programs/nextcloud.nix index 7e9bac14..86948e27 100644 --- a/lib/modules/programs/nextcloud.nix +++ b/lib/modules/programs/nextcloud.nix @@ -19,21 +19,40 @@ let }; }; }); + + commonOptions = { + enable = mkEnableOption "Nextcloud client"; + }; + + userOptions = { + folderSyncs = mkOption { + type = types.listOf syncType; + description = "The folders to synchronize"; + default = [ ]; + }; + }; in { options = { - valhalla.windows.users = mkOption { - type = types.attrsOf (types.submodule ( - { ... }: { - options = { - programs.nextcloud = { - folderSyncs = mkOption { - type = types.listOf syncType; - description = "The folders to synchronize."; - default = [ ]; - }; + valhalla = { + programs.nextcloud = commonOptions; + + users = mkOption { + type = types.attrsOf (types.submodule ( + { ... }: { + options = { + programs.nextcloud = commonOptions; }; - }; - })); + })); + }; + + windows.users = mkOption { + type = types.attrsOf (types.submodule ( + { ... }: { + options = { + programs.nextcloud = userOptions; + }; + })); + }; }; }; } diff --git a/lib/modules/programs/oh-my-posh.nix b/lib/modules/programs/oh-my-posh.nix index 713c4b93..ef6602bf 100644 --- a/lib/modules/programs/oh-my-posh.nix +++ b/lib/modules/programs/oh-my-posh.nix @@ -1,6 +1,6 @@ { lib, ... }: let - inherit (lib) mkOption types; + inherit (lib) mkEnableOption mkOption types; themeType = types.submodule ( { config, ... }: { @@ -18,35 +18,36 @@ let }; }); - ompType = types.submodule ( - { config, ... }: { - options = { - theme = mkOption { - type = types.nullOr (types.either types.str themeType); - description = "The default theme."; - default = null; - }; + commonOptions = { + enable = mkEnableOption "Oh My Posh"; + }; - additionalThemes = mkOption { - type = types.listOf themeType; - description = "A set of additional themes to install."; - default = [ ]; - }; - }; - }); + userOptions = commonOptions // { + theme = mkOption { + type = types.nullOr (types.either types.str themeType); + description = "The default theme."; + default = null; + }; + + additionalThemes = mkOption { + type = types.listOf themeType; + description = "A set of additional themes to install."; + default = [ ]; + }; + }; in { options = { - valhalla.users = mkOption { - type = types.attrsOf (types.submodule ( - { ... }: { - options = { - programs.oh-my-posh = mkOption { - type = ompType; - description = "The Oh My Posh configuration to apply."; - default = { }; + valhalla = { + programs.oh-my-posh = commonOptions; + + users = mkOption { + type = types.attrsOf (types.submodule ( + { ... }: { + options = { + programs.oh-my-posh = userOptions; }; - }; - })); + })); + }; }; }; } diff --git a/lib/modules/programs/rclone.nix b/lib/modules/programs/rclone.nix index 375effd4..8ad27eb3 100644 --- a/lib/modules/programs/rclone.nix +++ b/lib/modules/programs/rclone.nix @@ -1,6 +1,6 @@ { lib, ... }: let - inherit (lib) mkOption types; + inherit (lib) mkEnableOption mkOption types; syncType = types.submodule ( { ... }: { @@ -12,26 +12,36 @@ let cacheDuration = mkOption { type = types.nullOr types.str; - description = "The amount of time to keep cached files."; + description = "The amount of time to keep files in the cache."; default = null; }; }; }); + + commonOptions = { + enable = mkEnableOption "rclone"; + }; + + userOptions = commonOptions // { + configurations = mkOption { + type = types.attrsOf syncType; + description = "The configurations of the rclone mounts."; + default = { }; + }; + }; in { options = { - valhalla.linux.users = mkOption { - type = types.attrsOf (types.submodule ( - { ... }: { - options = { - programs.rclone = { - configurations = mkOption { - type = types.attrsOf syncType; - description = "The configurations of the rclone mounts."; - default = { }; - }; + valhalla.linux = { + programs.rclone = commonOptions; + + users = mkOption { + type = types.attrsOf (types.submodule ( + { ... }: { + options = { + programs.rclone = userOptions; }; - }; - })); + })); + }; }; }; }