Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Do not repeat dataDir #261

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions nix/apache-kafka.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,12 @@ in
with lib;
{
options = {
enable = mkEnableOption (lib.mdDoc "Apache Kafka event streaming broker");

port = mkOption {
description = lib.mdDoc "Port number the broker should listen on.";
default = 9092;
type = types.port;
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = lib.mdDoc "The apache-kafka data directory";
};

settings = mkOption {
description = lib.mdDoc ''
[Kafka broker configuration](https://kafka.apache.org/documentation.html#brokerconfigs)
Expand Down
8 changes: 0 additions & 8 deletions nix/cassandra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,8 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "cassandra" { };

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The cassandra data directory";
};

listenAddress = lib.mkOption {
type = types.str;
description = "Listen address";
Expand Down
8 changes: 0 additions & 8 deletions nix/clickhouse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkOption {
type = types.package;
description = "Which package of clickhouse to use";
Expand All @@ -21,12 +19,6 @@ in
default = 9000;
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The clickhouse data directory";
};

defaultExtraConfig = lib.mkOption {
type = yamlFormat.type;
internal = true;
Expand Down
8 changes: 0 additions & 8 deletions nix/elasticsearch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@ in
};
}
'';
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "elasticsearch7" { };

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "Directory where elasticsearch stores its data.";
};

listenAddress = lib.mkOption {
description = "Elasticsearch listen address.";
default = "127.0.0.1";
Expand Down
8 changes: 0 additions & 8 deletions nix/grafana.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ in
description = ''
Configure grafana.
'';
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "grafana" { };

http_port = lib.mkOption {
Expand All @@ -31,12 +29,6 @@ in
default = "http";
};

dataDir = lib.mkOption {
type = types.str;
description = "Directory where grafana stores its logs and data.";
default = "./data/${name}";
};

extraConf = lib.mkOption {
type = iniFormat.type;
description = "Extra configuration for grafana.";
Expand Down
6 changes: 6 additions & 0 deletions nix/lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
];
serviceModule = { config, name, ... }: {
options = {
enable = lib.mkEnableOption "Enable the ${service}.<name> service";
dataDir = lib.mkOption {
type = lib.types.str;
default = "./data/${name}";
description = "The directory where all data for `${service}.<name>` is stored";
};
namespace = lib.mkOption {
description = ''
Namespace for the ${service} service
Expand Down
8 changes: 0 additions & 8 deletions nix/mysql/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,13 @@ with lib.types; let
in
{
options = {
enable = lib.mkEnableOption "MySQL process and expose utilities";

package = lib.mkOption {
type = types.package;
description = "Which package of MySQL to use";
default = pkgs.mariadb;
defaultText = lib.literalExpression "pkgs.mariadb";
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The mysql data directory";
};

socketDir = lib.mkOption {
type = types.nullOr types.str;
default = config.dataDir;
Expand Down
8 changes: 0 additions & 8 deletions nix/nginx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,13 @@ in

{
options = {
enable = lib.mkEnableOption "nginx";

package = lib.mkOption {
type = lib.types.package;
default = pkgs.nginx;
defaultText = "pkgs.nginx";
description = "The nginx package to use.";
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The nginx data directory";
};

port = lib.mkOption {
type = types.port;
default = 8080;
Expand Down
10 changes: 1 addition & 9 deletions nix/ollama.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ let
in
{
options = {
enable = lib.mkEnableOption "Enable the Ollama service";
package = lib.mkOption {
type = types.package;
default = ollamaPackage;
Expand All @@ -25,14 +24,7 @@ in
example = "0.0.0.0";
description = "The host on which the Ollama service's REST API will listen";
};
dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = ''
The directory containing the Ollama models.
Sets the `OLLAMA_MODELS` environment variable.
'';
};

keepAlive = lib.mkOption {
type = types.str;
default = "5m";
Expand Down
7 changes: 0 additions & 7 deletions nix/open-webui.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@ let
in
{
options = {
enable = lib.mkEnableOption "Open-WebUI server";
package = lib.mkPackageOption pkgs "open-webui" { };

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The Open-WebUI data directory";
};

host = lib.mkOption {
type = types.str;
default = "127.0.0.1";
Expand Down
8 changes: 0 additions & 8 deletions nix/pgadmin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "pgadmin4" { };

host = lib.mkOption {
Expand Down Expand Up @@ -58,12 +56,6 @@ in
default = 6;
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The pgadmin4 data directory";
};

extraDefaultConfig = lib.mkOption {
type = pyType;
internal = true;
Expand Down
8 changes: 0 additions & 8 deletions nix/postgres/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ with lib.types; let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkOption {
type = types.package;
description = "Which package of postgresql to use";
Expand Down Expand Up @@ -44,12 +42,6 @@ in
'';
};

dataDir = lib.mkOption {
type = lib.types.str;
default = "./data/${name}";
description = "The DB data directory";
};

socketDir = lib.mkOption {
type = lib.types.str;
default = "";
Expand Down
8 changes: 0 additions & 8 deletions nix/prometheus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "prometheus" { };

port = lib.mkOption {
Expand All @@ -21,12 +19,6 @@ in
description = lib.mdDoc "Address to listen on for the web interface, API, and telemetry";
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The prometheus data directory";
};

extraFlags = lib.mkOption {
type = types.listOf types.str;
default = [ ];
Expand Down
8 changes: 0 additions & 8 deletions nix/redis-cluster.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,8 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "redis" { };

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The redis-cluster data directory (common for all nodes).";
};

nodes = lib.mkOption {
type = types.attrsOf (types.submodule {
options = {
Expand Down
8 changes: 0 additions & 8 deletions nix/redis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "redis" { };

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The redis data directory";
};

bind = lib.mkOption {
type = types.nullOr types.str;
default = "127.0.0.1";
Expand Down
1 change: 0 additions & 1 deletion nix/searxng.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ let
in
{
options = {
enable = lib.mkEnableOption name;
package = lib.mkPackageOption pkgs "searxng" { };

host = lib.mkOption {
Expand Down
8 changes: 0 additions & 8 deletions nix/tempo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ in
description = ''
Configure tempo.
'';
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "tempo" { };

httpAddress = lib.mkOption {
Expand All @@ -24,12 +22,6 @@ in
default = 3200;
};

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "The tempo data directory";
};

extraConfig = lib.mkOption {
type = yamlFormat.type;
default = { };
Expand Down
8 changes: 0 additions & 8 deletions nix/weaviate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,8 @@ let
in
{
options = {
enable = lib.mkEnableOption name;

package = lib.mkPackageOption pkgs "weaviate" { };

dataDir = lib.mkOption {
type = types.str;
default = "./data/${name}";
description = "Path to the Weaviate data store";
};

host = lib.mkOption {
type = types.str;
default = "127.0.0.1";
Expand Down
10 changes: 0 additions & 10 deletions nix/zookeeper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,12 @@
with lib;
{
options = {
enable = mkEnableOption (lib.mdDoc "Zookeeper");

port = mkOption {
description = lib.mdDoc "Zookeeper Client port.";
default = 2181;
type = types.port;
};

dataDir = mkOption {
type = types.str;
default = "./data/${name}";
description = lib.mdDoc ''
Data directory for Zookeeper
'';
};

id = mkOption {
description = lib.mdDoc "Zookeeper ID.";
default = 0;
Expand Down