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

View file

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

View file

@ -1,6 +1,11 @@
{ ... }:
{
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 = {
domain = "voronind.com";
sslCertificate = "/etc/letsencrypt/live/voronind.com/fullchain.pem";

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
services = {
tor = {
@ -34,7 +34,7 @@
xray = {
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.
{
__findFile,
config,
lib,
pkgsJobber,
poetry2nixJobber,
@ -28,7 +29,7 @@ in
bindMounts = {
"/data" = {
hostPath = "/storage/hot/data/jobber";
hostPath = "${config.module.const.host.data}/jobber";
isReadOnly = true;
};
};

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ config, pkgs, ... }:
{
# Vanilla.
# NOTE: tmux -S /var/lib/terraria/terraria.sock attach-session -t 0
@ -21,7 +21,7 @@
# NOTE: docker exec tmodloader inject "say Hello World!"
virtualisation.oci-containers.containers.terraria = {
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" ];
environment = {
TMOD_SHUTDOWN_MESSAGE = "Goodbye! <3";

View file

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

View file

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

View file

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