Home: Add hot_2 and migrate hot to hot_1.

This commit is contained in:
Dmitry Voronin 2025-01-28 10:48:38 +03:00
parent 8e384d9e22
commit 5fa62ac010
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
12 changed files with 42 additions and 32 deletions

View file

@ -1,5 +1,6 @@
{ {
__findFile, __findFile,
config,
pkgs, pkgs,
util, util,
... ...
@ -15,7 +16,7 @@ let
} }
# Define constants. # Define constants.
path_src="/storage/hot" path_src="/storage/hot_2"
path_mount="/storage/cold_1" path_mount="/storage/cold_1"
path_backup="''${path_mount}/backup" path_backup="''${path_mount}/backup"
path_data="''${path_backup}/home" path_data="''${path_backup}/home"
@ -47,20 +48,11 @@ let
bupsize=$(tdu ''${data} | awk '{print $1}') bupsize=$(tdu ''${data} | awk '{print $1}')
mv ''${data} ''${path_data}/ || report "Backup: Failed to save data!" mv ''${data} ''${path_data}/ || report "Backup: Failed to save data!"
# Backup some media. # Backup tmp media.
cd ''${path_src}
paper=$(archive paper/)
mv ''${paper} ''${path_backup}/paper/ || report "Backup: Failed to save paper!"
cd -
rcp_merge ''${path_src}/sync/save/ ''${path_backup}/save/tmp/ || report "Backup: Failed to save game saves!" rcp_merge ''${path_src}/sync/save/ ''${path_backup}/save/tmp/ || report "Backup: Failed to save game saves!"
rcp ''${path_src}/sync/photo/ ''${path_backup}/photo/tmp/ || report "Backup: Failed to save photos!" rcp ''${path_src}/sync/photo/ ''${path_backup}/photo/tmp/ || report "Backup: Failed to save photos!"
# Prune media copies. # Prune copies.
cd ''${path_backup}/paper/
archive_prune Paper 7
cd -
cd ''${path_backup}/cold/ cd ''${path_backup}/cold/
archive_prune ColdMediaTxt 30 archive_prune ColdMediaTxt 30
cd - cd -

View file

@ -1,6 +1,6 @@
{ lib, ... }: { config, lib, ... }:
let let
storage = "/storage/hot/data"; storage = config.module.const.host.data;
binds = [ binds = [
(mkBind "change" "/var/lib/changedetection-io") (mkBind "change" "/var/lib/changedetection-io")

View file

@ -1,6 +1,11 @@
{ ... }: { ... }:
{ {
config.module.const.host = { config.module.const.host = {
data = "/storage/hot_2/data";
download = "/storage/hot_1/download";
ftp = "/storage/hot_2/ftp";
share = "/storage/hot_1/share";
sync = "/storage/hot_2/sync";
nginx = { nginx = {
domain = "voronind.com"; domain = "voronind.com";
sslCertificate = "/etc/letsencrypt/live/voronind.com/fullchain.pem"; sslCertificate = "/etc/letsencrypt/live/voronind.com/fullchain.pem";

View file

@ -1,6 +1,6 @@
{ ... }: { config, ... }:
let let
storage = "/storage/hot/data/davis"; # TODO: Move to config. storage = "${config.module.const.host.data}/davis";
in in
{ {
services.davis = { services.davis = {

View file

@ -1,8 +1,8 @@
{ ... }: { config, ... }:
{ {
services.cloudflare-dyndns = { services.cloudflare-dyndns = {
enable = true; enable = true;
apiTokenFile = "/storage/hot/data/CfToken"; apiTokenFile = "${config.module.const.host.data}/CfToken";
deleteMissing = false; deleteMissing = false;
ipv4 = true; ipv4 = true;
ipv6 = true; ipv6 = true;

View file

@ -19,8 +19,17 @@
]; ];
}; };
"/storage/hot" = { "/storage/hot_1" = {
device = "/dev/storage/hot"; device = "/dev/storage/hot_1";
fsType = "ext4";
options = [
"noatime"
"nofail"
];
};
"/storage/hot_2" = {
device = "/dev/storage/hot_2";
fsType = "ext4"; fsType = "ext4";
options = [ options = [
"noatime" "noatime"
@ -30,7 +39,7 @@
}; };
# swapDevices = [{ # swapDevices = [{
# device = "/storage/hot/.swapfile"; # device = "/storage/hot_1/.swapfile";
# randomEncryption.enable = true; # randomEncryption.enable = true;
# size = 128 * 1024; # size = 128 * 1024;
# options = [ "nofail" ]; # options = [ "nofail" ];

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { config, pkgs, ... }:
{ {
services = { services = {
tor = { tor = {
@ -34,7 +34,7 @@
xray = { xray = {
enable = true; enable = true;
settingsFile = "/storage/hot/data/XrayClient.json"; settingsFile = "${config.module.const.host.data}/XrayClient.json";
}; };
}; };
} }

View file

@ -1,6 +1,7 @@
# Use `nixos-container login jobber` as root and empty pw. # Use `nixos-container login jobber` as root and empty pw.
{ {
__findFile, __findFile,
config,
lib, lib,
pkgsJobber, pkgsJobber,
poetry2nixJobber, poetry2nixJobber,
@ -28,7 +29,7 @@ in
bindMounts = { bindMounts = {
"/data" = { "/data" = {
hostPath = "/storage/hot/data/jobber"; hostPath = "${config.module.const.host.data}/jobber";
isReadOnly = true; isReadOnly = true;
}; };
}; };

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { config, pkgs, ... }:
{ {
# Vanilla. # Vanilla.
# NOTE: tmux -S /var/lib/terraria/terraria.sock attach-session -t 0 # NOTE: tmux -S /var/lib/terraria/terraria.sock attach-session -t 0
@ -21,7 +21,7 @@
# NOTE: docker exec tmodloader inject "say Hello World!" # NOTE: docker exec tmodloader inject "say Hello World!"
virtualisation.oci-containers.containers.terraria = { virtualisation.oci-containers.containers.terraria = {
image = "jacobsmile/tmodloader1.4:latest"; image = "jacobsmile/tmodloader1.4:latest";
volumes = [ "/storage/hot/data/terraria_calamity:/data" ]; volumes = [ "${config.module.const.host.data}/terraria_calamity:/data" ];
ports = [ "0.0.0.0:22777:7777" ]; ports = [ "0.0.0.0:22777:7777" ];
environment = { environment = {
TMOD_SHUTDOWN_MESSAGE = "Goodbye! <3"; TMOD_SHUTDOWN_MESSAGE = "Goodbye! <3";

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { config, pkgs, ... }:
{ {
services.transmission = { services.transmission = {
enable = true; enable = true;
@ -6,7 +6,7 @@
# REF: https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md # REF: https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md
settings = settings =
let let
downloadDir = "/storage/hot/download"; downloadDir = config.module.const.host.download;
in in
{ {
bind-address-ipv4 = "0.0.0.0"; bind-address-ipv4 = "0.0.0.0";

View file

@ -1,4 +1,7 @@
{ ... }: { config, ... }:
let
host = config.module.const.host;
in
{ {
user.voronind = true; user.voronind = true;
@ -14,7 +17,7 @@
}; };
syncthing = { syncthing = {
enable = true; enable = true;
dataDir = "/storage/hot/sync"; dataDir = host.sync;
user = "root"; user = "root";
group = "root"; group = "root";
}; };
@ -49,7 +52,7 @@
}; };
ftpd = { ftpd = {
enable = true; enable = true;
storage = "/storage/hot/ftp"; storage = host.ftp;
}; };
hwmon = { hwmon = {
file = "temp1_input"; file = "temp1_input";

View file

@ -1,7 +1,7 @@
{ config, ... }: { config, ... }:
let let
cfg = config.module.const.host.nginx; cfg = config.module.const.host.nginx;
root = "/storage/hot/share"; root = config.module.const.host.share;
index = '' index = ''
autoindex on; autoindex on;
charset UTF-8; charset UTF-8;