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,9 +1,10 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
inherit (lib) mkEnableOption mkOption types;
gitOption = {
enable = mkEnableOption "git";
gitType = types.submodule ({ ... }: {
options = {
defaultBranch = mkOption {
type = types.nullOr types.str;
description = "The name of the default branch in newly created repositories.";
@ -30,13 +31,6 @@ let
default = { };
};
};
});
gitOption = mkOption {
type = gitType;
description = "The git related options.";
default = { };
};
in {
options = {
valhalla = {

View file

@ -19,21 +19,40 @@ let
};
};
});
in {
options = {
valhalla.windows.users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
programs.nextcloud = {
commonOptions = {
enable = mkEnableOption "Nextcloud client";
};
userOptions = {
folderSyncs = mkOption {
type = types.listOf syncType;
description = "The folders to synchronize.";
description = "The folders to synchronize";
default = [ ];
};
};
in {
options = {
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,9 +18,11 @@ let
};
});
ompType = types.submodule (
{ config, ... }: {
options = {
commonOptions = {
enable = mkEnableOption "Oh My Posh";
};
userOptions = commonOptions // {
theme = mkOption {
type = types.nullOr (types.either types.str themeType);
description = "The default theme.";
@ -33,20 +35,19 @@ let
default = [ ];
};
};
});
in {
options = {
valhalla.users = mkOption {
valhalla = {
programs.oh-my-posh = commonOptions;
users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
programs.oh-my-posh = mkOption {
type = ompType;
description = "The Oh My Posh configuration to apply.";
default = { };
};
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;
};
};
});
in {
options = {
valhalla.linux.users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
programs.rclone = {
commonOptions = {
enable = mkEnableOption "rclone";
};
userOptions = commonOptions // {
configurations = mkOption {
type = types.attrsOf syncType;
description = "The configurations of the rclone mounts.";
default = { };
};
};
in {
options = {
valhalla.linux = {
programs.rclone = commonOptions;
users = mkOption {
type = types.attrsOf (types.submodule (
{ ... }: {
options = {
programs.rclone = userOptions;
};
}));
};
};
};
}