Migrate matrix from Container to VM

This commit is contained in:
Greg Hellings
2024-11-19 22:43:13 -06:00
parent 7ac381d15c
commit bbe6d20e57
7 changed files with 158 additions and 118 deletions
Generated
+37
View File
@@ -714,6 +714,42 @@
"type": "github"
}
},
"nixlib": {
"locked": {
"lastModified": 1731805462,
"narHash": "sha256-yhEMW4MBi+IAyEJyiKbnFvY1uARyMKJpLUhkczI49wk=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "b9f04e3cf71c23bea21d2768051e6b3068d44734",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixos-generators": {
"inputs": {
"nixlib": "nixlib",
"nixpkgs": [
"nixunstable"
]
},
"locked": {
"lastModified": 1731892054,
"narHash": "sha256-BJtD9NGUWaBe4OZ1JO77w8qBP9yHDJJUjsxkG/milFc=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "15a87ccb45e06d24a9fd5f99a49782efe11b23f0",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixos-generators",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1723282977,
@@ -971,6 +1007,7 @@
"hmunstable": "hmunstable",
"hooks": "hooks",
"nix23_05": "nix23_05",
"nixos-generators": "nixos-generators",
"nixstable": "nixstable",
"nixunstable": "nixunstable",
"nixvimstable": "nixvimstable",
+7 -3
View File
@@ -37,6 +37,10 @@
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixstable";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixunstable";
};
nixvimstable.url = "github:nix-community/nixvim/nixos-24.05";
nixvimunstable.url = "github:nix-community/nixvim/main";
nix23_05.url = "github:NixOS/nixpkgs/nixos-23.05";
@@ -57,9 +61,9 @@
packages_overlay = (
_: prev:
(import ./pkgs {
inherit self;
inherit self top;
pkgs = prev;
}).packages
})
);
overlays = [
top.agenix.overlays.default
@@ -104,7 +108,7 @@
pkgs = import top.nixstable { inherit system overlays; };
};
imports = [ ./pkgs ];
packages = import ./pkgs { inherit pkgs top; };
checks = import ./checks.nix {
inherit system;
+4
View File
@@ -1,5 +1,6 @@
{ top, overlays, ... }:
let
vm = args: (unstable (args // { extraMods = [ top.nixos-generators.nixosModules.all-formats ]; }));
wsl = args: (unstable (args // { extraMods = [ top.wsl.nixosModules.wsl ]; }));
unstable =
args:
@@ -61,6 +62,9 @@ in
hosea = unstable { name = "hosea"; };
jeremiah = unstable { name = "jeremiah"; };
isaiah = unstable { name = "isaiah"; };
vm-matrix = vm { name = "vm-matrix"; };
iso = machine { name = "iso"; };
iso-beta = unstable { name = "iso"; };
# nix build '.#nixosConfigurations.wsl.config.system.build.installer'
-1
View File
@@ -4,7 +4,6 @@
./ceph.nix
./hardware-configuration.nix
./git.nix
./matrix.nix
./minio.nix
];
-99
View File
@@ -1,99 +0,0 @@
{ pkgs, ... }:
let
conn = "postgresql:///dendrite?sslmode=disable&host=/run/postgresql";
in
{
environment.systemPackages = with pkgs; [ upgrade-pg-cluster ];
greg.containers.matrix = {
tailscale = true;
subnet = "204";
builder =
{ config, ... }:
{
networking.firewall.allowedTCPPorts = [ config.services.dendrite.httpPort ];
# Environment secrets
age = {
secrets.dendrite = {
file = ../../secrets/dendrite.age;
owner = "dendrite";
};
secrets.dendrite_key = {
file = ../../secrets/dendrite_key.age;
owner = "dendrite";
};
};
users.users.dendrite = {
isSystemUser = true;
group = "dendrite";
};
users.groups.dendrite = { };
systemd.services.dendrite.serviceConfig = {
User = "dendrite";
};
greg.databases.dendrite = { };
services.dendrite = {
enable = true;
environmentFile = config.age.secrets.dendrite.path;
httpPort = 8448;
# Identify ourselves as the root of our own domain
settings = (
(builtins.listToAttrs (
(map
(x: {
name = x;
value = {
database.connection_string = conn;
};
})
[
"app_service_api"
"federation_api"
"key_server"
"media_api"
"mscs"
"relay_api"
"room_server"
"sync_api"
]
)
))
// {
user_api.account_database.connection_string = conn;
user_api.device_database.connection_string = conn;
global = {
database = {
connection_string = conn;
max_open_conns = 25;
max_idle_conns = 5;
conn_max_lifetime = -1;
};
server_name = "thehellings.com";
trusted_third_party_id_servers = [
"matrix.org"
"vector.im"
"jupiterbroadcasting.com"
];
# Generate this with {path-to-dendrite}/bin/generate-keys --private-key /etc/dendrite.pem
private_key = config.age.secrets.dendrite_key.path;
};
client_api = {
registration_enabled = false;
registration_shared_secret = "\${REGISTRATION_SHARED_SECRET}";
};
}
);
};
systemd.services.dendrite = {
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
};
};
};
}
+95
View File
@@ -0,0 +1,95 @@
{ pkgs, config, ... }:
let
conn = "postgresql:///dendrite?sslmode=disable&host=/run/postgresql";
in
{
environment.systemPackages = with pkgs; [ upgrade-pg-cluster ];
greg = {
tailscale.enable = true;
};
networking.firewall.allowedTCPPorts = [ config.services.dendrite.httpPort ];
# Environment secrets
age = {
secrets.dendrite = {
file = ../../secrets/dendrite.age;
owner = "dendrite";
};
secrets.dendrite_key = {
file = ../../secrets/dendrite_key.age;
owner = "dendrite";
};
};
users.users = {
dendrite = {
isSystemUser = true;
group = "dendrite";
};
greg.initialPassword = "password";
};
users.groups.dendrite = { };
systemd.services.dendrite.serviceConfig = {
User = "dendrite";
};
greg.databases.dendrite = { };
services.dendrite = {
enable = true;
environmentFile = config.age.secrets.dendrite.path;
httpPort = 8448;
# Identify ourselves as the root of our own domain
settings = (
(builtins.listToAttrs (
map
(x: {
name = x;
value = {
database.connection_string = conn;
};
})
[
"app_service_api"
"federation_api"
"key_server"
"media_api"
"mscs"
"relay_api"
"room_server"
"sync_api"
]
))
// {
user_api.account_database.connection_string = conn;
user_api.device_database.connection_string = conn;
global = {
database = {
connection_string = conn;
max_open_conns = 25;
max_idle_conns = 5;
conn_max_lifetime = -1;
};
server_name = "thehellings.com";
trusted_third_party_id_servers = [
"matrix.org"
"vector.im"
"jupiterbroadcasting.com"
];
# Generate this with {path-to-dendrite}/bin/generate-keys --private-key /etc/dendrite.pem
private_key = config.age.secrets.dendrite_key.path;
};
client_api = {
registration_enabled = false;
registration_shared_secret = "\${REGISTRATION_SHARED_SECRET}";
};
}
);
};
systemd.services.dendrite = {
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
};
}
+15 -15
View File
@@ -1,21 +1,21 @@
{ pkgs, ... }:
{ pkgs, top, ... }:
let
c = pkgs.callPackage;
in
{
packages = {
#default = iso;
#iso = top.self.nixosConfigurations.iso.config.system.build.isoImage;
#iso-beta = self.nixosConfigurations.iso-beta.config.system.build.isoImage;
aacs = c ./aacs.nix { };
brew = c ./homebrew.nix { };
create_ssl = c ./create_ssl.nix { };
inject-darwin = c ./inject-darwin.nix { };
inject = c ./inject.nix { };
hms = c ./hms { };
setup-ssh = c ./setup-ssh { };
upgrade-pg-cluster = c ./upgrade-pg-cluster.nix { };
zim = c ./zim.nix { };
};
#default = iso;
#iso = top.self.nixosConfigurations.iso.config.system.build.isoImage;
#iso-beta = self.nixosConfigurations.iso-beta.config.system.build.isoImage;
aacs = c ./aacs.nix { };
brew = c ./homebrew.nix { };
create_ssl = c ./create_ssl.nix { };
inject-darwin = c ./inject-darwin.nix { };
inject = c ./inject.nix { };
hms = c ./hms { };
setup-ssh = c ./setup-ssh { };
upgrade-pg-cluster = c ./upgrade-pg-cluster.nix { };
zim = c ./zim.nix { };
matrix = top.nixosConfigurations.vm-matrix.config.formats.qcow;
}