forked from Fediversity/Fediversity
This PR builds on top of #447 and #448. Since these might be rejected, there will be some changes needed for this PR as well. Let's see how the discussions go in #447.
In the meantime, @fricklerhandwerk, would you mind (in)validating the core idea of this PR? You only need to look at 7cf43c4041
, really.
Reviewed-on: Fediversity/Fediversity#449
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
Co-committed-by: Nicolas “Niols” Jeannerod <nicolas.jeannerod@moduscreate.com>
59 lines
1.3 KiB
Nix
59 lines
1.3 KiB
Nix
{
|
|
inputs,
|
|
sources,
|
|
lib,
|
|
}:
|
|
|
|
let
|
|
inherit (builtins) fromJSON readFile listToAttrs;
|
|
inherit (import ./constants.nix)
|
|
targetMachines
|
|
pathToRoot
|
|
pathFromRoot
|
|
enableAcme
|
|
;
|
|
|
|
makeTargetResource = nodeName: {
|
|
imports = [ ../common/targetResource.nix ];
|
|
_module.args = { inherit inputs sources; };
|
|
inherit
|
|
nodeName
|
|
pathToRoot
|
|
pathFromRoot
|
|
enableAcme
|
|
;
|
|
};
|
|
|
|
## The deployment function - what we are here to test!
|
|
##
|
|
## TODO: Modularise `deployment/default.nix` to get rid of the nested
|
|
## function calls.
|
|
makeTestDeployment =
|
|
args:
|
|
(import ../..)
|
|
{
|
|
inherit lib;
|
|
inherit (inputs) nixops4 nixops4-nixos;
|
|
fediversity = import ../../../services/fediversity;
|
|
}
|
|
(listToAttrs (
|
|
map (nodeName: {
|
|
name = "${nodeName}ConfigurationResource";
|
|
value = makeTargetResource nodeName;
|
|
}) targetMachines
|
|
))
|
|
(fromJSON (readFile ../../configuration.sample.json) // args);
|
|
|
|
in
|
|
{
|
|
check-deployment-cli-nothing = makeTestDeployment { };
|
|
|
|
check-deployment-cli-mastodon-pixelfed = makeTestDeployment {
|
|
mastodon.enable = true;
|
|
pixelfed.enable = true;
|
|
};
|
|
|
|
check-deployment-cli-peertube = makeTestDeployment {
|
|
peertube.enable = true;
|
|
};
|
|
}
|