Add options for enabling programs individually

This commit is contained in:
Manuel Thalmann 2024-10-13 20:14:54 +02:00
parent bdc02756eb
commit bd7d8f8080
4 changed files with 104 additions and 80 deletions

View file

@ -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 = {

View file

@ -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;
};
}));
};
};
};
}

View file

@ -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;
};
};
}));
}));
};
};
};
}

View file

@ -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;
};
};
}));
}));
};
};
};
}