blob: 84819f6b97fb9dad3f276fd59ce55ab1d13d568b [file] [log] [blame]
Bartosz Stebel821b8392023-03-05 23:21:37 +01001{ config, pkgs, lib, ... }:
Serge Bazanski712a5dc2023-02-28 01:15:40 +00002
3with builtins;
Bartosz Stebel821b8392023-03-05 23:21:37 +01004let postgresPkg = pkgs.postgresql_14;
5in rec {
Serge Bazanski712a5dc2023-02-28 01:15:40 +00006 networking.hostName = "bc01n05";
7 # TODO: undefine fqdn and define domain after big nix change
8 hscloud.base.fqdn = "${networking.hostName}.hswaw.net";
9 #networking.domain = "hswaw.net";
10 system.stateVersion = "22.05";
11 nix.maxJobs = 16;
12
Bartosz Stebel821b8392023-03-05 23:21:37 +010013 ### zfs
14 # randomly generated
15 networking.hostId = "26dbfbcd";
16 boot.supportedFilesystems = [ "zfs" ];
17 boot.initrd.supportedFilesystems = [ "zfs" ];
18 services.zfs.trim.enable = true;
19
Serge Bazanski712a5dc2023-02-28 01:15:40 +000020 boot.loader.grub.device = "/dev/sda";
Bartosz Stebel821b8392023-03-05 23:21:37 +010021 fileSystems = {
22 "/" = {
23 device = "rpool/nixos/root";
24 fsType = lib.mkForce "zfs";
25 options = [ "X-mount.mkdir" ];
26 };
27 "/home" = {
28 device = "rpool/nixos/home";
29 fsType = "zfs";
30 options = [ "X-mount.mkdir" ];
31 };
32 "/var/lib/postgresql" = {
33 device = "rpool/postgres";
34 fsType = "zfs";
35 options = [ "X-mount.mkdir" ];
36 };
37 "/boot" = {
38 device = "/dev/disk/by-uuid/2a951c5d-0193-4ef3-9227-d8a5184cbd63";
39 fsType = "ext4";
40 };
Serge Bazanski712a5dc2023-02-28 01:15:40 +000041 };
42
43 hscloud.base = {
44 mgmtIf = "eno1";
45 ipAddr = "185.236.240.37";
46 ipAddrBits = 28;
47 gw = "185.236.240.33";
48 };
Bartosz Stebel821b8392023-03-05 23:21:37 +010049
50 environment.systemPackages = [postgresPkg];
51 services.postgresql = {
52 enable = true;
53 package = postgresPkg;
54 enableTCPIP = true;
55 initdbArgs = ["--encoding='UTF8'" "--lc-collate='C'" "--lc-ctype='C'"];
56 ensureDatabases = ["synapse" "mediarepo"];
57 ensureUsers = [
58 {
59 name = "synapse";
60 ensurePermissions = {
61 "DATABASE synapse" = "ALL PRIVILEGES";
62 };
63 }
64 {
65 name = "mediarepo";
66 ensurePermissions = {
67 "DATABASE mediarepo" = "ALL PRIVILEGES";
68 };
69 }
70 ];
71 # TODO actually allow synapse to talk to us
72 # also adjust firewall
73 authentication = pkgs.lib.mkOverride 10 ''
74 local all all trust
75 host all all 127.0.0.1/32 trust
76 host all all ::1/128 trust
77 '';
78 };
Serge Bazanski712a5dc2023-02-28 01:15:40 +000079}
80