minifedi/nix/services.nix

53 lines
1.4 KiB
Nix
Raw Normal View History

2023-07-30 20:02:53 +00:00
{ pkgs, config }:
let
2023-07-30 20:02:53 +00:00
instances = config.instances;
util = import ./util.nix { inherit pkgs; };
2023-07-13 02:12:36 +00:00
evaldInstances = builtins.listToAttrs (builtins.map (inst:
2023-07-14 04:21:21 +00:00
pkgs.lib.attrsets.nameValuePair inst.name (inst.type ({
2023-07-30 20:02:53 +00:00
inherit pkgs util;
2023-07-13 02:12:36 +00:00
host = "${inst.name}.lvh.me";
users = [
{
name = "a";
email = "a@example.com";
password = "MiniFediA1!";
admin = true;
}
{
name = "b";
email = "b@example.com";
password = "MiniFediB1!";
admin = false;
}
{
name = "c";
email = "c@example.com";
password = "MiniFediC1!";
admin = false;
}
{
name = "d";
email = "d@example.com";
password = "MiniFediD1!";
admin = false;
}
{
name = "e";
email = "e@example.com";
password = "MiniFediE1!";
admin = false;
}
];
2023-07-30 20:02:53 +00:00
proxy = if config.mitmproxy then "http://localhost:8080" else null;
2023-07-13 02:12:36 +00:00
} // inst))) instances);
in evaldInstances // {
postgres = import ./support-services/postgres { inherit pkgs; };
redis = import ./support-services/redis { inherit pkgs; };
nginx = import ./support-services/nginx {
inherit pkgs;
2023-07-13 02:12:36 +00:00
instances = evaldInstances;
};
2023-07-30 20:02:53 +00:00
} // pkgs.lib.attrsets.optionalAttrs config.mitmproxy {
mitmproxy = import ./support-services/mitmproxy { inherit pkgs; };
}