From fba96d6905661e170709d218aa191ed2d61fca51 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 2 Oct 2023 20:54:32 +0000 Subject: [PATCH] Add snapraid --- flake.nix | 6 +++- hosts/kadan/hardware-configuration.nix | 39 ++++++++++++++++++++------ modules/misc/impermanence.nix | 1 + 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 7e5d98c..3a51223 100644 --- a/flake.nix +++ b/flake.nix @@ -99,7 +99,11 @@ saikai = mkSystem "saikai" "server" []; - kadan = mkSystem "kadan" "server" []; + kadan = mkSystem "kadan" "server" [ + ({pkgs, ...}: { + environment.systemPackages = with pkgs; [tmux]; + }) + ]; }; }; } diff --git a/hosts/kadan/hardware-configuration.nix b/hosts/kadan/hardware-configuration.nix index fad679a..5772706 100644 --- a/hosts/kadan/hardware-configuration.nix +++ b/hosts/kadan/hardware-configuration.nix @@ -36,27 +36,27 @@ fsType = "vfat"; }; - fileSystems."/media/a" = { + fileSystems."/mnt/a" = { device = "/dev/disk/by-label/sda"; fsType = "ext4"; }; - fileSystems."/media/c" = { + fileSystems."/mnt/c" = { device = "/dev/disk/by-label/sdc"; fsType = "ext4"; }; - fileSystems."/media/d" = { + fileSystems."/mnt/d" = { device = "/dev/disk/by-label/sdd"; fsType = "ext4"; }; - fileSystems."/media/parity" = { + fileSystems."/mnt/parity" = { device = "/dev/disk/by-label/parity"; fsType = "ext4"; }; - environment.systemPackages = with pkgs; [ mergerfs ]; - fileSystems."/media/kyoo" = { - device = "/media/a:/media/c:/media/d"; - depends = ["/media/a" "/media/c" "/media/d"]; + environment.systemPackages = with pkgs; [mergerfs]; + fileSystems."/mnt/kyoo" = { + device = "/mnt/a:/mnt/c:/mnt/d"; + depends = ["/mnt/a" "/mnt/c" "/mnt/d"]; fsType = "fuse.mergerfs"; options = [ "func.getattr=newest" # For kyoo's scanner @@ -66,6 +66,29 @@ ]; }; + snapraid = { + enable = true; + exclude = [ + "*.unrecoverable" + "/tmp/" + "/lost+found/" + ]; + dataDisks = { + a = "/mnt/a/"; + c = "/mnt/c/"; + d = "/mnt/d/"; + }; + contentFiles = [ + "/var/snapraid.content" + "/mnt/a/snapraid.content" + "/mnt/c/snapraid.content" + "/mnt/d/snapraid.content" + ]; + parityFiles = [ + "/mnt/parity/snapraid.parity" + ]; + }; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking diff --git a/modules/misc/impermanence.nix b/modules/misc/impermanence.nix index 2f4d0da..6e1b83d 100644 --- a/modules/misc/impermanence.nix +++ b/modules/misc/impermanence.nix @@ -34,6 +34,7 @@ "/etc/ssh/ssh_host_ed25519_key.pub" "/etc/ssh/ssh_host_rsa_key" "/etc/ssh/ssh_host_rsa_key.pub" + "/var/snapraid.content" ]; users.zoriya = { directories = [