Compare commits
1 Commits
9f62e03d95
...
microvm-mo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
edddfc5e3f |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,4 +6,3 @@ result
|
|||||||
.direnv/
|
.direnv/
|
||||||
book/
|
book/
|
||||||
fanny-efi-vars.fd
|
fanny-efi-vars.fd
|
||||||
nix-store-overlay.img
|
|
||||||
|
|||||||
@@ -20,13 +20,6 @@ in
|
|||||||
inputs.self.nixosModules.malobeo.metrics
|
inputs.self.nixosModules.malobeo.metrics
|
||||||
];
|
];
|
||||||
|
|
||||||
virtualisation.vmVariantWithDisko = {
|
|
||||||
virtualisation = {
|
|
||||||
memorySize = 4096;
|
|
||||||
cores = 3;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
malobeo.metrics = {
|
malobeo.metrics = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enablePromtail = true;
|
enablePromtail = true;
|
||||||
@@ -63,11 +56,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"L /var/lib/microvms/data - - - - /data/microvms"
|
|
||||||
"d /data/microvms 0755 root root" #not needed for real host?
|
|
||||||
];
|
|
||||||
|
|
||||||
malobeo.initssh = {
|
malobeo.initssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
authorizedKeys = sshKeys.admins;
|
authorizedKeys = sshKeys.admins;
|
||||||
@@ -81,7 +69,8 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.malobeo.microvm.enableHostBridge = true;
|
services.malobeo.microvm.enableHostBridge = true;
|
||||||
services.malobeo.microvm.deployHosts = [ "overwatch" "infradocs" "nextcloud" "durruti" ];
|
services.malobeo.microvm.deployHosts = [ "overwatch" "infradocs" "durruti" ];
|
||||||
|
services.malobeo.microvm.client.nextcloud.enable = true;
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
nat = {
|
nat = {
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ in
|
|||||||
mountOptions = [ "umask=0077" ];
|
mountOptions = [ "umask=0077" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
encryptedSwap = lib.mkIf cfg.encryption {
|
encryptedSwap = {
|
||||||
size = cfg.root.swap;
|
size = cfg.root.swap;
|
||||||
content = {
|
content = {
|
||||||
type = "swap";
|
type = "swap";
|
||||||
@@ -252,10 +252,6 @@ in
|
|||||||
type = "zfs_fs";
|
type = "zfs_fs";
|
||||||
mountpoint = "/data";
|
mountpoint = "/data";
|
||||||
};
|
};
|
||||||
"encrypted/data/microvm" = {
|
|
||||||
type = "zfs_fs";
|
|
||||||
mountpoint = "/data/microvm";
|
|
||||||
};
|
|
||||||
reserved = {
|
reserved = {
|
||||||
# for cow delete if pool is full
|
# for cow delete if pool is full
|
||||||
options = {
|
options = {
|
||||||
|
|||||||
@@ -70,13 +70,6 @@ rec {
|
|||||||
proto = "virtiofs";
|
proto = "virtiofs";
|
||||||
socket = "var.socket";
|
socket = "var.socket";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
source = "/var/lib/microvms/data/${hostName}";
|
|
||||||
mountPoint = "/data";
|
|
||||||
tag = "data";
|
|
||||||
proto = "virtiofs";
|
|
||||||
socket = "microdata.socket";
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
interfaces = [
|
interfaces = [
|
||||||
|
|||||||
28
machines/modules/malobeo/microvm_client.nix
Normal file
28
machines/modules/malobeo/microvm_client.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{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";
|
||||||
|
}];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ 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 = "/data/services/nextcloud/";
|
datadir = "/datadir";
|
||||||
database.createLocally = true;
|
database.createLocally = true;
|
||||||
config.dbtype = "pgsql";
|
config.dbtype = "pgsql";
|
||||||
configureRedis = true;
|
configureRedis = true;
|
||||||
|
|||||||
@@ -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 ];
|
microvm.imports = [ ./machines/modules/malobeo/microvm_host.nix ./machines/modules/malobeo/microvm_client.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