Move Garage VM stuff out of main file

This commit is contained in:
Nicolas Jeannerod 2024-09-24 14:40:35 +02:00
parent 050042d255
commit 042cb2d517
Signed by: Niols
GPG key ID: 35DB9EC8886E1CB8
5 changed files with 33 additions and 20 deletions

View file

@ -134,20 +134,6 @@ in
}; };
config = lib.mkIf config.fediversity.enable { config = lib.mkIf config.fediversity.enable {
# virtualisation.diskSize = 2048;
# virtualisation.forwardPorts = [
# {
# from = "host";
# host.port = fedicfg.rpc.port;
# guest.port = fedicfg.rpc.port;
# }
# {
# from = "host";
# host.port = fedicfg.web.port;
# guest.port = fedicfg.web.port;
# }
# ];
environment.systemPackages = [ pkgs.minio-client pkgs.awscli ]; environment.systemPackages = [ pkgs.minio-client pkgs.awscli ];
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [

View file

@ -17,6 +17,7 @@
## VM-specific modules ## VM-specific modules
interactive-vm = import ./vm/interactive-vm.nix; interactive-vm = import ./vm/interactive-vm.nix;
garage-vm = import ./vm/garage-vm.nix;
mastodon-vm = import ./vm/mastodon-vm.nix; mastodon-vm = import ./vm/mastodon-vm.nix;
peertube-vm = import ./vm/peertube-vm.nix; peertube-vm = import ./vm/peertube-vm.nix;
pixelfed-vm = import ./vm/pixelfed-vm.nix; pixelfed-vm = import ./vm/pixelfed-vm.nix;
@ -25,17 +26,17 @@
nixosConfigurations = { nixosConfigurations = {
mastodon = nixpkgs.lib.nixosSystem { mastodon = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = with self.nixosModules; [ fediversity interactive-vm mastodon-vm ]; modules = with self.nixosModules; [ fediversity interactive-vm garage-vm mastodon-vm ];
}; };
peertube = nixpkgs.lib.nixosSystem { peertube = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = with self.nixosModules; [ fediversity interactive-vm peertube-vm ]; modules = with self.nixosModules; [ fediversity interactive-vm garage-vm peertube-vm ];
}; };
pixelfed = nixpkgs.lib.nixosSystem { pixelfed = nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = with self.nixosModules; [ fediversity interactive-vm pixelfed-vm ]; modules = with self.nixosModules; [ fediversity interactive-vm garage-vm pixelfed-vm ];
}; };
all = nixpkgs.lib.nixosSystem { all = nixpkgs.lib.nixosSystem {
@ -43,6 +44,7 @@
modules = with self.nixosModules; [ modules = with self.nixosModules; [
fediversity fediversity
interactive-vm interactive-vm
garage-vm
peertube-vm peertube-vm
pixelfed-vm pixelfed-vm
mastodon-vm mastodon-vm

View file

@ -37,7 +37,7 @@ pkgs.nixosTest {
nodes = { nodes = {
server = { config, ... }: { server = { config, ... }: {
virtualisation.memorySize = lib.mkVMOverride 4096; virtualisation.memorySize = lib.mkVMOverride 4096;
imports = with self.nixosModules; [ mastodon-vm ]; imports = with self.nixosModules; [ garage-vm mastodon-vm ];
# TODO: pair down # TODO: pair down
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
python3 python3

View file

@ -136,7 +136,7 @@ pkgs.nixosTest {
memorySize = lib.mkVMOverride 8192; memorySize = lib.mkVMOverride 8192;
cores = 8; cores = 8;
}; };
imports = with self.nixosModules; [ pixelfed-vm ]; imports = with self.nixosModules; [ garage-vm pixelfed-vm ];
# TODO: pair down # TODO: pair down
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
python3 python3

25
vm/garage-vm.nix Normal file
View file

@ -0,0 +1,25 @@
{ config, modulesPath, ... }:
let
fedicfg = config.fediversity.internal.garage;
in {
imports = [
../fediversity
(modulesPath + "/virtualisation/qemu-vm.nix")
];
virtualisation.diskSize = 2048;
virtualisation.forwardPorts = [
{
from = "host";
host.port = fedicfg.rpc.port;
guest.port = fedicfg.rpc.port;
}
{
from = "host";
host.port = fedicfg.web.port;
guest.port = fedicfg.web.port;
}
];
}