Share options that can be shared

This commit is contained in:
Nicolas Jeannerod 2025-02-14 19:21:31 +01:00
parent b547912794
commit 8c5bf79ba2
Signed by untrusted user: Niols
GPG key ID: 35DB9EC8886E1CB8
4 changed files with 71 additions and 92 deletions

View file

@ -1,35 +1,14 @@
{ config, lib, ... }: { config, lib, ... }:
let
inherit (lib) mkOption mkEnableOption;
inherit (lib.types) types;
in
{ {
options.fediversity.mastodon = { options.fediversity.mastodon =
enable = mkEnableOption "Enable a Mastodon server on the machine"; (import ../sharedOptions.nix {
inherit config lib;
serviceName = "mastodon";
serviceDocName = "Mastodon";
})
//
s3AccessKey = mkOption { {
type = types.str;
description = ''
S3 access key
In AWS CLI, this would be AWS_ACCESS_KEY_ID.
'';
}; };
s3SecretKey = mkOption {
description = ''
S3 secret key
In AWS CLI, this would be AWS_SECRET_ACCESS_KEY.
'';
};
domain = mkOption {
type = types.str;
description = "Internal option change at your own risk";
default = "mastodon.${config.fediversity.domain}";
};
};
} }

View file

@ -1,45 +1,28 @@
{ config, lib, ... }: { config, lib, ... }:
let let
inherit (lib) mkOption mkEnableOption; inherit (lib) mkOption;
inherit (lib.types) types; inherit (lib.types) types;
in in
{ {
options.fediversity.peertube = { options.fediversity.peertube =
enable = mkEnableOption "Enable a PeerTube server on the machine"; (import ../sharedOptions.nix {
inherit config lib;
serviceName = "peertube";
serviceDocName = "PeerTube";
})
//
s3AccessKey = mkOption { {
type = types.str; secretsFile = mkOption {
description = '' type = types.path;
S3 access key description = ''
Internal option change at your own risk
In AWS CLI, this would be AWS_ACCESS_KEY_ID. FIXME: should it be provided by NixOps4?
''; or maybe we should just ask for a main secret from which to derive all the others?
'';
};
}; };
s3SecretKey = mkOption {
description = ''
S3 secret key
In AWS CLI, this would be AWS_SECRET_ACCESS_KEY.
'';
};
domain = mkOption {
type = types.str;
description = "Internal option change at your own risk";
default = "peertube.${config.fediversity.domain}";
};
secretsFile = mkOption {
type = types.path;
description = ''
Internal option change at your own risk
FIXME: should it be provided by NixOps4?
or maybe we should just ask for a main secret from which to derive all the others?
'';
};
};
} }

View file

@ -1,35 +1,14 @@
{ config, lib, ... }: { config, lib, ... }:
let
inherit (lib) mkOption mkEnableOption;
inherit (lib.types) types;
in
{ {
options.fediversity.pixelfed = { options.fediversity.pixelfed =
enable = mkEnableOption "Enable a Pixelfed server on the machine"; (import ../sharedOptions.nix {
inherit config lib;
serviceName = "pixelfed";
serviceDocName = "Pixelfed";
})
//
s3AccessKey = mkOption { {
type = types.str;
description = ''
S3 access key
In AWS CLI, this would be AWS_ACCESS_KEY_ID.
'';
}; };
s3SecretKey = mkOption {
description = ''
S3 secret key
In AWS CLI, this would be AWS_SECRET_ACCESS_KEY.
'';
};
domain = mkOption {
type = types.str;
description = "Internal option change at your own risk";
default = "pixelfed.${config.fediversity.domain}";
};
};
} }

View file

@ -0,0 +1,38 @@
{
config,
lib,
serviceName,
serviceDocName,
}:
let
inherit (lib) mkOption mkEnableOption;
inherit (lib.types) types;
in
{
enable = mkEnableOption "Enable a ${serviceDocName} server on the machine";
s3AccessKey = mkOption {
type = types.str;
description = ''
S3 access key for ${serviceDocName}'s bucket/s
In AWS CLI, this would be AWS_ACCESS_KEY_ID.
'';
};
s3SecretKey = mkOption {
description = ''
S3 secret key for ${serviceDocName}'s bucket/s
In AWS CLI, this would be AWS_SECRET_ACCESS_KEY.
'';
};
domain = mkOption {
type = types.str;
description = "Internal option change at your own risk";
default = "${serviceName}.${config.fediversity.domain}";
};
}