forked from Fediversity/Fediversity
Closes #277 Same as #329 but where we run the FediPanel and interact with it via a browser instead of running NixOps4 directly. Reviewed-on: Fediversity/Fediversity#361 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>
91 lines
1.9 KiB
Nix
91 lines
1.9 KiB
Nix
{
|
|
self,
|
|
inputs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
inherit (builtins)
|
|
fromJSON
|
|
listToAttrs
|
|
;
|
|
|
|
targetMachines = [
|
|
"garage"
|
|
"mastodon"
|
|
"peertube"
|
|
"pixelfed"
|
|
];
|
|
pathToRoot = /. + (builtins.unsafeDiscardStringContext self);
|
|
pathFromRoot = ./.;
|
|
enableAcme = true;
|
|
|
|
in
|
|
{
|
|
perSystem =
|
|
{ pkgs, ... }:
|
|
{
|
|
checks.deployment-panel = pkgs.testers.runNixOSTest {
|
|
imports = [
|
|
../common/nixosTest.nix
|
|
./nixosTest.nix
|
|
];
|
|
_module.args.inputs = inputs;
|
|
inherit
|
|
targetMachines
|
|
pathToRoot
|
|
pathFromRoot
|
|
enableAcme
|
|
;
|
|
};
|
|
};
|
|
|
|
nixops4Deployments =
|
|
let
|
|
makeTargetResource = nodeName: {
|
|
imports = [ ../common/targetResource.nix ];
|
|
_module.args.inputs = inputs;
|
|
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
|
|
))
|
|
args;
|
|
|
|
in
|
|
{
|
|
check-deployment-panel = makeTestDeployment (
|
|
fromJSON (
|
|
let
|
|
env = builtins.getEnv "DEPLOYMENT";
|
|
in
|
|
if env == "" then
|
|
throw "The DEPLOYMENT environment needs to be set. You do not want to use this deployment unless in the `deployment-panel` NixOS test."
|
|
else
|
|
env
|
|
)
|
|
);
|
|
};
|
|
}
|