create top-level switch whether a machine holds the application data

This commit is contained in:
Pim Kunis 2024-01-06 21:45:18 +01:00
parent 97fc20e251
commit 10dbccae97
2 changed files with 21 additions and 3 deletions

View file

@ -38,9 +38,7 @@
nixosModule.lab = { nixosModule.lab = {
disko.osDiskDevice = "/dev/sda"; disko.osDiskDevice = "/dev/sda";
backups.enable = true; dataHost.enable = true;
networking.allowDMZConnectivity = true;
data-sharing.enable = true;
dataDisk = { dataDisk = {
enable = true; enable = true;

View file

@ -1,3 +1,7 @@
{ lib, config, ... }:
let cfg = config.lab.dataHost;
in
{ {
imports = [ imports = [
./terraform-database ./terraform-database
@ -9,4 +13,20 @@
./networking.nix ./networking.nix
./data-sharing.nix ./data-sharing.nix
]; ];
options.lab.dataHost.enable = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Whether this machine holds application data.
This enables NFS and PostgreSQL to serve this data, and sets up backups.
Also enables networking on the DMZ to enable serving data.
'';
};
config.lab = lib.mkIf cfg.enable {
backups.enable = true;
data-sharing.enable = true;
networking.allowDMZConnectivity = true;
};
} }