Compare commits
9 Commits
microvm-mo
...
issue31
| Author | SHA1 | Date | |
|---|---|---|---|
| 2f4cb3787b | |||
| 4f9e66ba82 | |||
| 1f9d39b53d | |||
|
|
362d9cf488 | ||
|
|
c51c1e8e92 | ||
|
|
a96b8f65c9 | ||
| 29d6bc02e0 | |||
|
|
c0cef1ff1e | ||
|
|
7099c92236 |
@@ -26,6 +26,7 @@ in
|
|||||||
|
|
||||||
malobeo.disks = {
|
malobeo.disks = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
legacy = true;
|
||||||
hostId = "a3c3102f";
|
hostId = "a3c3102f";
|
||||||
root = {
|
root = {
|
||||||
disk0 = "disk/by-id/ata-HITACHI_HTS725016A9A364_110308PCKB04VNHX9XTJ";
|
disk0 = "disk/by-id/ata-HITACHI_HTS725016A9A364_110308PCKB04VNHX9XTJ";
|
||||||
@@ -33,9 +34,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
malobeo.initssh = {
|
malobeo.initssh = {
|
||||||
enable = true;
|
enable = false;
|
||||||
authorizedKeys = sshKeys.admins;
|
|
||||||
ethernetDrivers = ["r8169"];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware.sane.enable = true; #scanner support
|
hardware.sane.enable = true; #scanner support
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ in
|
|||||||
disk0 = "disk/by-id/ata-SAMSUNG_MZ7LN256HCHP-000L7_S20HNAAH200381";
|
disk0 = "disk/by-id/ata-SAMSUNG_MZ7LN256HCHP-000L7_S20HNAAH200381";
|
||||||
};
|
};
|
||||||
storage = {
|
storage = {
|
||||||
|
enable = true;
|
||||||
disks = ["disk/by-id/wwn-0x50014ee265b53b60" "disk/by-id/wwn-0x50014ee2bb0a194a"];
|
disks = ["disk/by-id/wwn-0x50014ee265b53b60" "disk/by-id/wwn-0x50014ee2bb0a194a"];
|
||||||
mirror = true;
|
mirror = true;
|
||||||
};
|
};
|
||||||
@@ -69,8 +70,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.malobeo.microvm.enableHostBridge = true;
|
services.malobeo.microvm.enableHostBridge = true;
|
||||||
services.malobeo.microvm.deployHosts = [ "overwatch" "infradocs" "durruti" ];
|
services.malobeo.microvm.deployHosts = [ "overwatch" "infradocs" "nextcloud" "durruti" ];
|
||||||
services.malobeo.microvm.client.nextcloud.enable = true;
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
nat = {
|
nat = {
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ in
|
|||||||
default = true;
|
default = true;
|
||||||
description = "Allows encryption to be disabled for testing";
|
description = "Allows encryption to be disabled for testing";
|
||||||
};
|
};
|
||||||
|
legacy = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable legacy boot (bios)";
|
||||||
|
};
|
||||||
devNodes = lib.mkOption {
|
devNodes = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "/dev/disk/by-id/";
|
default = "/dev/disk/by-id/";
|
||||||
@@ -81,7 +86,25 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf (cfg.enable && !cfg.legacy) {
|
||||||
|
boot = {
|
||||||
|
loader.systemd-boot.enable = true;
|
||||||
|
loader.efi.canTouchEfiVariables = true;
|
||||||
|
supportedFilesystems = [ "vfat" "zfs" ];
|
||||||
|
};
|
||||||
|
fileSystems."/boot".neededForBoot = true;
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.enable && cfg.legacy) {
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = lib.mkForce true;
|
||||||
|
device = "/dev/${cfg.root.disk0}-part1";
|
||||||
|
efiSupport = false;
|
||||||
|
enableCryptodisk = cfg.encryption;
|
||||||
|
zfsSupport = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf cfg.enable {
|
||||||
networking.hostId = cfg.hostId;
|
networking.hostId = cfg.hostId;
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk = lib.mkMerge [
|
disk = lib.mkMerge [
|
||||||
@@ -92,7 +115,7 @@ in
|
|||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
ESP = {
|
ESP = lib.mkIf (!cfg.legacy) {
|
||||||
size = "1024M";
|
size = "1024M";
|
||||||
type = "EF00";
|
type = "EF00";
|
||||||
content = {
|
content = {
|
||||||
@@ -102,6 +125,10 @@ in
|
|||||||
mountOptions = [ "umask=0077" ];
|
mountOptions = [ "umask=0077" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
boot = lib.mkIf cfg.legacy {
|
||||||
|
size = "1024M";
|
||||||
|
type = "EF02";
|
||||||
|
};
|
||||||
encryptedSwap = {
|
encryptedSwap = {
|
||||||
size = cfg.root.swap;
|
size = cfg.root.swap;
|
||||||
content = {
|
content = {
|
||||||
@@ -187,7 +214,6 @@ in
|
|||||||
postCreateHook = lib.mkIf cfg.encryption ''
|
postCreateHook = lib.mkIf cfg.encryption ''
|
||||||
zfs set keylocation="prompt" zroot/encrypted;
|
zfs set keylocation="prompt" zroot/encrypted;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
"encrypted/root" = {
|
"encrypted/root" = {
|
||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
@@ -268,11 +294,12 @@ in
|
|||||||
|
|
||||||
boot.zfs.devNodes = lib.mkDefault cfg.devNodes;
|
boot.zfs.devNodes = lib.mkDefault cfg.devNodes;
|
||||||
boot.zfs.extraPools = lib.mkIf cfg.storage.enable [ "storage" ];
|
boot.zfs.extraPools = lib.mkIf cfg.storage.enable [ "storage" ];
|
||||||
|
|
||||||
fileSystems."/".neededForBoot = true;
|
fileSystems."/".neededForBoot = true;
|
||||||
fileSystems."/etc".neededForBoot = true;
|
fileSystems."/etc".neededForBoot = true;
|
||||||
fileSystems."/boot".neededForBoot = true;
|
|
||||||
fileSystems."/var".neededForBoot = true;
|
fileSystems."/var".neededForBoot = true;
|
||||||
fileSystems."/home".neededForBoot = true;
|
fileSystems."/home".neededForBoot = true;
|
||||||
fileSystems."/nix".neededForBoot = true;
|
fileSystems."/nix".neededForBoot = true;
|
||||||
};
|
})
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf (cfg.enable && config.malobeo.disks.encryption) {
|
config = lib.mkIf (cfg.enable && config.malobeo.disks.encryption) {
|
||||||
boot = {
|
boot = {
|
||||||
loader.systemd-boot.enable = true;
|
|
||||||
loader.efi.canTouchEfiVariables = true;
|
|
||||||
supportedFilesystems = [ "vfat" "zfs" ];
|
|
||||||
zfs = {
|
zfs = {
|
||||||
requestEncryptionCredentials = true;
|
requestEncryptionCredentials = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
{config, lib, pkgs, ...}:
|
|
||||||
let
|
|
||||||
cfg = config.services.malobeo.microvm.client;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.services.malobeo.microvm.client = {
|
|
||||||
nextcloud = {
|
|
||||||
enable = lib.mkEnableOption "enable the nextcloud microvm wrapper";
|
|
||||||
datadir = lib.mkOption {
|
|
||||||
type = lib.types.string;
|
|
||||||
default = "/data/services/nextcloud/";
|
|
||||||
description = "set a custom datadir";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
(lib.mkIf cfg.nextcloud.enable { #add check for run-vm?
|
|
||||||
services.malobeo.microvm.deployHosts = ["nextcloud"];
|
|
||||||
microvm.vms.nextcloud.config.microvm.shares = lib.mkAfter [{
|
|
||||||
source = cfg.datadir;
|
|
||||||
mountPoint = "/datadir";
|
|
||||||
tag = "nc-datadir";
|
|
||||||
proto = "virtiofs";
|
|
||||||
}];
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -30,6 +30,13 @@
|
|||||||
publicKey = "TrJ4UAF//zXdaLwZudI78L+rTC36zEDodTDOWNS4Y1Y=";
|
publicKey = "TrJ4UAF//zXdaLwZudI78L+rTC36zEDodTDOWNS4Y1Y=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"hetzner" = {
|
||||||
|
role = "client";
|
||||||
|
address = [ "10.100.0.6/24" ];
|
||||||
|
allowedIPs = [ "10.100.0.6/32" ];
|
||||||
|
publicKey = "csRzgwtnzmSLeLkSwTwEOrdKq55UOxZacR5D3GopCTQ=";
|
||||||
|
};
|
||||||
|
|
||||||
"fanny" = {
|
"fanny" = {
|
||||||
role = "client";
|
role = "client";
|
||||||
address = [ "10.100.0.101/24" ];
|
address = [ "10.100.0.101/24" ];
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ with lib;
|
|||||||
hostName = "cloud.malobeo.org";
|
hostName = "cloud.malobeo.org";
|
||||||
config.adminpassFile = config.sops.secrets.nextcloudAdminPass.path;
|
config.adminpassFile = config.sops.secrets.nextcloudAdminPass.path;
|
||||||
#https = true; #disable for testing
|
#https = true; #disable for testing
|
||||||
datadir = "/datadir";
|
|
||||||
database.createLocally = true;
|
database.createLocally = true;
|
||||||
config.dbtype = "pgsql";
|
config.dbtype = "pgsql";
|
||||||
configureRedis = true;
|
configureRedis = true;
|
||||||
@@ -56,12 +55,6 @@ with lib;
|
|||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
trusted_domains = ["10.0.0.13"];
|
trusted_domains = ["10.0.0.13"];
|
||||||
"maintenance_window_start" = "1";
|
|
||||||
"default_phone_region" = "DE";
|
|
||||||
};
|
|
||||||
phpOptions = {
|
|
||||||
"realpath_cache_size" = "0";
|
|
||||||
"opcache.interned_strings_buffer" = "23";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ in (utils.lib.eachSystem (builtins.filter filter_system utils.lib.defaultSystems
|
|||||||
|
|
||||||
nixosModules.malobeo = {
|
nixosModules.malobeo = {
|
||||||
host.imports = [ ./machines/durruti/host_config.nix ];
|
host.imports = [ ./machines/durruti/host_config.nix ];
|
||||||
microvm.imports = [ ./machines/modules/malobeo/microvm_host.nix ./machines/modules/malobeo/microvm_client.nix];
|
microvm.imports = [ ./machines/modules/malobeo/microvm_host.nix ];
|
||||||
vpn.imports = [ ./machines/modules/malobeo/wireguard.nix ];
|
vpn.imports = [ ./machines/modules/malobeo/wireguard.nix ];
|
||||||
initssh.imports = [ ./machines/modules/malobeo/initssh.nix ];
|
initssh.imports = [ ./machines/modules/malobeo/initssh.nix ];
|
||||||
metrics.imports = [ ./machines/modules/malobeo/metrics.nix ];
|
metrics.imports = [ ./machines/modules/malobeo/metrics.nix ];
|
||||||
|
|||||||
Reference in New Issue
Block a user