From 47f81834909ea468d7ecea9da01d029d3c1777a5 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 3 Jan 2023 22:59:30 +0100 Subject: [PATCH] tsuki: move all datafiles/drives to TrueNAS NFS --- hosts/tsuki/configuration.nix | 15 +++++++++------ hosts/tsuki/extra-hardware-configuration.nix | 13 +++++++++++++ hosts/tsuki/hardware-configuration.nix | 10 ---------- hosts/tsuki/services/postgres.nix | 6 +++--- 4 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 hosts/tsuki/extra-hardware-configuration.nix diff --git a/hosts/tsuki/configuration.nix b/hosts/tsuki/configuration.nix index ccfd5ad..55a4085 100644 --- a/hosts/tsuki/configuration.nix +++ b/hosts/tsuki/configuration.nix @@ -2,6 +2,7 @@ { imports = [ ./hardware-configuration.nix + ./extra-hardware-configuration.nix # ./services/calibre.nix ./services/gitea @@ -23,14 +24,16 @@ machineVars = { headless = true; - dataDrives = let - momiji = "/data2"; - in { + dataDrives = { drives = { - cirno = "/data"; - inherit momiji; + backup = "/data2/backup"; + momiji = "/data2/momiji"; + cirno = "/data2/cirno"; + media = "/data2/media"; + postgres = "/data2/postgres"; + home = "/data2/home"; }; - default = momiji; + default = "/data2/momiji"; }; }; diff --git a/hosts/tsuki/extra-hardware-configuration.nix b/hosts/tsuki/extra-hardware-configuration.nix new file mode 100644 index 0000000..7ef040b --- /dev/null +++ b/hosts/tsuki/extra-hardware-configuration.nix @@ -0,0 +1,13 @@ +{ ... }: let + nfsDrive = drivename: { + device = "10.0.0.36:/mnt/PoolsClosed/${drivename}"; + fsType = "nfs"; + options = [ "nfsvers=3" ]; + }; +in { + fileSystems."/data2/backup" = nfsDrive "backup"; + fileSystems."/data2/momiji" = nfsDrive "momiji"; + fileSystems."/data2/media" = nfsDrive "media"; + fileSystems."/data2/postgres" = nfsDrive "postgres"; + fileSystems."/data2/home" = nfsDrive "home"; +} diff --git a/hosts/tsuki/hardware-configuration.nix b/hosts/tsuki/hardware-configuration.nix index 89050e4..abe483d 100644 --- a/hosts/tsuki/hardware-configuration.nix +++ b/hosts/tsuki/hardware-configuration.nix @@ -23,16 +23,6 @@ fsType = "vfat"; }; - fileSystems."/data" = - { device = "/dev/disk/by-uuid/87354b26-4f7f-4b94-96fd-4bbeb834a03b"; - fsType = "btrfs"; - }; - - fileSystems."/data2" = - { device = "/dev/disk/by-uuid/c481da40-08dd-4d6d-abeb-f1976cb4271a"; - fsType = "btrfs"; - }; - swapDevices = [ { device = "/dev/disk/by-uuid/92a1a33f-89a8-45de-a45e-6c303172cd7f"; } ]; diff --git a/hosts/tsuki/services/postgres.nix b/hosts/tsuki/services/postgres.nix index 66851db..a69fcf3 100644 --- a/hosts/tsuki/services/postgres.nix +++ b/hosts/tsuki/services/postgres.nix @@ -10,7 +10,7 @@ host all all ::1/128 trust ''; port = secrets.ports.postgres; - dataDir = "${config.machineVars.dataDrives.default}/db/postgres/${config.services.postgresql.package.psqlSchema}"; + dataDir = "${config.machineVars.dataDrives.drives.postgres}/${config.services.postgresql.package.psqlSchema}"; # settings = {}; }; @@ -18,7 +18,7 @@ enable = true; openFirewall = true; initialEmail = "h7x4@nani.wtf"; - initialPasswordFile = "${config.machineVars.dataDrives.default}/var/pgadmin_pass"; + initialPasswordFile = "${config.machineVars.dataDrives.default}/keys/pgadmin_pass"; port = secrets.ports.pgadmin; settings = { DATA_DIR = "${config.machineVars.dataDrives.default}/var/pgadmin"; @@ -27,7 +27,7 @@ services.postgresqlBackup = { enable = true; - location = "${config.machineVars.dataDrives.default}/backup/postgres"; + location = "${config.machineVars.dataDrives.drives.backup}/postgres"; backupAll = true; }; }