1
0
Fork 0

Get panel config as a block - use eg. mastodon.enable

This commit is contained in:
Nicolas Jeannerod 2025-02-27 11:43:44 +01:00
parent 07b3cd90d7
commit f34f2e45ab
Signed by untrusted user: Niols
GPG key ID: 35DB9EC8886E1CB8
2 changed files with 15 additions and 18 deletions
deployment
infra/test-machines

View file

@ -30,13 +30,10 @@
## partially applied only until here.
## Information on the specific deployment that we request. This is the
## information that will come from the FediPanel.
{
domain,
enableMastodon,
enablePeertube,
enablePixelfed,
}:
## information coming from the FediPanel.
##
## FIXME: lock step the interface with the definitions in the FediPanel
panelConfig:
let
inherit (lib) mkMerge mkIf;
@ -106,12 +103,12 @@ in
mkMerge [
(mkIf (enableMastodon || enablePeertube || enablePixelfed) {
(mkIf (panelConfig.mastodon.enable || panelConfig.peertube.enable || panelConfig.pixelfed.enable) {
garage-configuration = makeConfigurationResource garageConfigurationResource (
{ pkgs, ... }:
{
fediversity = {
inherit domain;
inherit (panelConfig) domain;
garage.enable = true;
pixelfed = pixelfedS3KeyConfig { inherit pkgs; };
mastodon = mastodonS3KeyConfig { inherit pkgs; };
@ -121,12 +118,12 @@ in
);
})
(mkIf enableMastodon {
(mkIf panelConfig.mastodon.enable {
mastodon-configuration = makeConfigurationResource mastodonConfigurationResource (
{ pkgs, ... }:
{
fediversity = {
inherit domain;
inherit (panelConfig) domain;
mastodon = mastodonS3KeyConfig { inherit pkgs; } // {
enable = true;
};
@ -137,12 +134,12 @@ in
);
})
(mkIf enablePeertube {
(mkIf panelConfig.peertube.enable {
peertube-configuration = makeConfigurationResource peertubeConfigurationResource (
{ pkgs, ... }:
{
fediversity = {
inherit domain;
inherit (panelConfig) domain;
peertube = peertubeS3KeyConfig { inherit pkgs; } // {
enable = true;
## NOTE: Only ever used for testing anyway.
@ -155,12 +152,12 @@ in
);
})
(mkIf enablePixelfed {
(mkIf panelConfig.pixelfed.enable {
pixelfed-configuration = makeConfigurationResource pixelfedConfigurationResource (
{ pkgs, ... }:
{
fediversity = {
inherit domain;
inherit (panelConfig) domain;
pixelfed = pixelfedS3KeyConfig { inherit pkgs; } // {
enable = true;
};

View file

@ -1,6 +1,6 @@
{
"domain": "abundos.eu",
"enableMastodon": false,
"enablePeertube": false,
"enablePixelfed": false
"mastodon": { "enable": false },
"peertube": { "enable": false },
"pixelfed": { "enable": false }
}