diff --git a/flake.nix b/flake.nix index b7c7970..566d88a 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,11 @@ "@garage-config" ]; + postgresSubvolumes = [ + "postgres" + "postgres-cfg" + ]; + sharedModule = { extraPackages ? [ ] }: { services.openssh.settings.PasswordAuthentication = false; @@ -102,10 +107,10 @@ }; }; - makeDockerConfig = { hostName, volume }: nixpkgs.lib.nixosSystem { + makeDockerConfig = { hostname, volume, baseModule }: nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ - image-builder.packages.aarch64-linux.modules.rockPro64v2 + baseModule (sharedModule { extraPackages = with pkgs; [ @@ -114,7 +119,7 @@ ]; }) { - networking.hostName = hostName; + networking.hostName = hostname; virtualisation.docker.enable = true; @@ -136,22 +141,23 @@ }; in { - nixosConfigurations.nextcloud1 = makeDockerConfig { - hostName = "nextcloud1"; - volume = { - # "ssh://192.168.20.28/btrfs/hdd" = btrbkSecondary { - # target-dir = "/btrfs/hdd/@snapshots"; - # subvolumes = nextcloudSubvolumes; - # }; - "/btrfs/hdd" = btrbkPrimary { - subvolumes = nextcloudSubvolumes; + nixosConfigurations = with image-builder.packages.aarch64-linux.modules; { + nextcloud1 = makeDockerConfig { + hostname = "nextcloud1"; + volume = { + # "ssh://192.168.20.28/btrfs/hdd" = btrbkSecondary { + # target-dir = "/btrfs/hdd/@snapshots"; + # subvolumes = nextcloudSubvolumes; + # }; + "/btrfs/hdd" = btrbkPrimary { + subvolumes = nextcloudSubvolumes; + }; }; + baseModule = rockPro64v2; }; - }; - nixosConfigurations.nextcloud2 = - makeDockerConfig { - hostName = "nextcloud2"; + nextcloud2 = makeDockerConfig { + hostname = "nextcloud2"; volume = { "ssh://192.168.20.21/btrfs/hdd" = btrbkSecondary { target-dir = "/btrfs/hdd/@snapshots"; @@ -161,8 +167,66 @@ # subvolumes = nextcloudSubvolumes; # }; }; + baseModule = rockPro64v2; }; + redtail1 = makeDockerConfig { + hostname = "redtail1"; + volume = { + "ssh://192.168.20.24/btrfs/ssd" = btrbkSecondary { + target-dir = "/btrfs/ssd/@snapshots"; + subvolumes = postgresSubvolumes; + }; + # "/btrfs/ssd" = btrbkPrimary { + # subvolumes = postgresSubvolumes; + # }; + }; + baseModule = rock64; + }; + + redtail2 = makeDockerConfig { + hostname = "redtail2"; + volume = { + # "ssh://192.168.20.23/btrfs/ssd" = btrbkSecondary { + # target-dir = "/btrfs/ssd/@snapshots"; + # subvolumes = postgresSubvolumes; + # }; + "/btrfs/ssd" = btrbkPrimary { + subvolumes = postgresSubvolumes; + }; + }; + baseModule = rock64; + }; + + whitestorm1 = makeDockerConfig { + hostname = "whitestorm1"; + volume = { + # "ssh://192.168.20.11/btrfs/ssd" = btrbkSecondary { + # target-dir = "/btrfs/ssd/@snapshots"; + # subvolumes = postgresSubvolumes; + # }; + "/btrfs/ssd" = btrbkPrimary { + subvolumes = postgresSubvolumes; + }; + }; + baseModule = rock64; + }; + + whitestorm2 = makeDockerConfig { + hostname = "whitestorm2"; + volume = { + "ssh://192.168.20.26/btrfs/ssd" = btrbkSecondary { + target-dir = "/btrfs/ssd/@snapshots"; + subvolumes = postgresSubvolumes; + }; + # "/btrfs/ssd" = btrbkPrimary { + # subvolumes = postgresSubvolumes; + # }; + }; + baseModule = rock64; + }; + }; + deploy.nodes.nextcloud2 = deployer { hostname = "192.168.20.28"; configuration = self.nixosConfigurations.nextcloud2;