Create a configuration resource even if the service is disabled

This commit is contained in:
Nicolas Jeannerod 2025-03-27 15:49:38 +01:00
parent 535da821fd
commit af3b2a62fd
Signed by untrusted user: Niols
GPG key ID: 35DB9EC8886E1CB8

View file

@ -36,7 +36,7 @@
panelConfig: panelConfig:
let let
inherit (lib) mkMerge mkIf; inherit (lib) mkIf;
in in
@ -101,90 +101,81 @@ in
in in
mkMerge [ {
garage-configuration = makeConfigurationResource garageConfigurationResource (
{ pkgs, ... }:
mkIf (panelConfig.mastodon.enable || panelConfig.peertube.enable || panelConfig.pixelfed.enable) {
fediversity = {
inherit (panelConfig) domain;
garage.enable = true;
pixelfed = pixelfedS3KeyConfig { inherit pkgs; };
mastodon = mastodonS3KeyConfig { inherit pkgs; };
peertube = peertubeS3KeyConfig { inherit pkgs; };
};
}
);
(mkIf (panelConfig.mastodon.enable || panelConfig.peertube.enable || panelConfig.pixelfed.enable) { mastodon-configuration = makeConfigurationResource mastodonConfigurationResource (
garage-configuration = makeConfigurationResource garageConfigurationResource ( { pkgs, ... }:
{ pkgs, ... }: mkIf panelConfig.mastodon.enable {
{ fediversity = {
fediversity = { inherit (panelConfig) domain;
inherit (panelConfig) domain; temp.initialUser = {
garage.enable = true; inherit (panelConfig.initialUser) username email displayName;
pixelfed = pixelfedS3KeyConfig { inherit pkgs; }; # FIXME: disgusting, but nvm, this is going to be replaced by
mastodon = mastodonS3KeyConfig { inherit pkgs; }; # proper central authentication at some point
peertube = peertubeS3KeyConfig { inherit pkgs; }; passwordFile = pkgs.writeText "password" panelConfig.initialUser.password;
}; };
}
);
})
(mkIf panelConfig.mastodon.enable { mastodon = mastodonS3KeyConfig { inherit pkgs; } // {
mastodon-configuration = makeConfigurationResource mastodonConfigurationResource ( enable = true;
{ pkgs, ... }:
{
fediversity = {
inherit (panelConfig) domain;
temp.initialUser = {
inherit (panelConfig.initialUser) username email displayName;
# FIXME: disgusting, but nvm, this is going to be replaced by
# proper central authentication at some point
passwordFile = pkgs.writeText "password" panelConfig.initialUser.password;
};
mastodon = mastodonS3KeyConfig { inherit pkgs; } // {
enable = true;
};
temp.cores = 1; # FIXME: should come from NixOps4 eventually
}; };
}
);
})
(mkIf panelConfig.peertube.enable { temp.cores = 1; # FIXME: should come from NixOps4 eventually
peertube-configuration = makeConfigurationResource peertubeConfigurationResource ( };
{ pkgs, ... }: }
{ );
fediversity = {
inherit (panelConfig) domain;
temp.initialUser = {
inherit (panelConfig.initialUser) username email displayName;
# FIXME: disgusting, but nvm, this is going to be replaced by
# proper central authentication at some point
passwordFile = pkgs.writeText "password" panelConfig.initialUser.password;
};
peertube = peertubeS3KeyConfig { inherit pkgs; } // { peertube-configuration = makeConfigurationResource peertubeConfigurationResource (
enable = true; { pkgs, ... }:
## NOTE: Only ever used for testing anyway. mkIf panelConfig.peertube.enable {
## fediversity = {
## FIXME: Generate and store in NixOps4's state. inherit (panelConfig) domain;
secretsFile = pkgs.writeText "secret" "574e093907d1157ac0f8e760a6deb1035402003af5763135bae9cbd6abe32b24"; temp.initialUser = {
}; inherit (panelConfig.initialUser) username email displayName;
# FIXME: disgusting, but nvm, this is going to be replaced by
# proper central authentication at some point
passwordFile = pkgs.writeText "password" panelConfig.initialUser.password;
}; };
}
);
})
(mkIf panelConfig.pixelfed.enable { peertube = peertubeS3KeyConfig { inherit pkgs; } // {
pixelfed-configuration = makeConfigurationResource pixelfedConfigurationResource ( enable = true;
{ pkgs, ... }: ## NOTE: Only ever used for testing anyway.
{ ##
fediversity = { ## FIXME: Generate and store in NixOps4's state.
inherit (panelConfig) domain; secretsFile = pkgs.writeText "secret" "574e093907d1157ac0f8e760a6deb1035402003af5763135bae9cbd6abe32b24";
temp.initialUser = {
inherit (panelConfig.initialUser) username email displayName;
# FIXME: disgusting, but nvm, this is going to be replaced by
# proper central authentication at some point
passwordFile = pkgs.writeText "password" panelConfig.initialUser.password;
};
pixelfed = pixelfedS3KeyConfig { inherit pkgs; } // {
enable = true;
};
}; };
} };
); }
}) );
];
pixelfed-configuration = makeConfigurationResource pixelfedConfigurationResource (
{ pkgs, ... }:
mkIf panelConfig.pixelfed.enable {
fediversity = {
inherit (panelConfig) domain;
temp.initialUser = {
inherit (panelConfig.initialUser) username email displayName;
# FIXME: disgusting, but nvm, this is going to be replaced by
# proper central authentication at some point
passwordFile = pkgs.writeText "password" panelConfig.initialUser.password;
};
pixelfed = pixelfedS3KeyConfig { inherit pkgs; } // {
enable = true;
};
};
}
);
};
} }