storage: add snapraid

This commit is contained in:
Vivian 2023-12-29 02:23:21 +01:00
parent 75af9679d2
commit d7eb7b48b6
4 changed files with 44 additions and 36 deletions

6
flake.lock generated
View file

@ -234,11 +234,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1703781671, "lastModified": 1703800106,
"narHash": "sha256-sldUCqfp0E3AV82jJ2YLi0tbOajn9fg4+ms9naeAYKA=", "narHash": "sha256-PceYQ8qL0GsOMl22FBzJON1aZeFfj+HJqptGKEdT1EM=",
"owner": "jdonszelmann", "owner": "jdonszelmann",
"repo": "essentials", "repo": "essentials",
"rev": "6b10889113e4356e0b5d050874effb9b9f3d8903", "rev": "49d5ed74bca121b9fb750f43e53c815dff61e223",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -41,6 +41,8 @@ in {
fsType = "nfs"; fsType = "nfs";
}; };
systemd.services.rtorrent.after = [ "nfs-client.target" ];
services.flood = { services.flood = {
enable = true; enable = true;
host = "0.0.0.0"; host = "0.0.0.0";

View file

@ -1,32 +1,13 @@
# Edit this configuration file to define what should be installed on { ... }:
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{ {
imports = imports = [ # Include the results of the hardware scan.
[ # Include the results of the hardware scan. ./hardware-configuration.nix
./hardware-configuration.nix ./fs.nix
./fs.nix ];
];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
networking.hostName = "storage"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Define a user account. Don't forget to set a password with passwd.
users.users.vivian = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
};
# Enable the OpenSSH daemon. # Enable the OpenSSH daemon.
services.openssh.enable = true; services.openssh.enable = true;
@ -36,12 +17,44 @@
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
services.nfs.server = { services.nfs.server = {
enable = true; enable = true;
exports = '' exports = ''
/mnt/storage *(rw,async,no_subtree_check,fsid=0,all_squash,anonuid=0,anongid=0) /mnt/storage *(rw,async,no_subtree_check,fsid=0,all_squash,anonuid=0,anongid=0)
''; '';
}; };
services.snapraid = {
enable = true;
parityFiles =
[ "/mnt/parity1/snapraid.parity" "/mnt/parity2/snapraid.parity-2" ];
dataDisks = {
d1 = "/mnt/disk1";
d2 = "/mnt/disk2";
d3 = "/mnt/disk3";
d4 = "/mnt/disk4";
d5 = "/mnt/disk5";
d6 = "/mnt/disk6";
};
contentFiles = [
"/var/lib/snapraid/snapraid.content"
"/mnt/disk1/snapraid.content"
"/mnt/disk2/snapraid.content"
"/mnt/disk3/snapraid.content"
"/mnt/disk5/snapraid.content"
];
exclude = [
"/lost+found/"
"*.tmp"
"/tmp/"
"*.unrecoverable"
"/.Trash-1000/"
"/rancher/"
"/torrents/"
"/exclusion-zone/"
"/roms/"
"/roms/"
];
};
} }

View file

@ -1,6 +1,6 @@
{ pkgs, ... }: { { pkgs, ... }: {
environment.systemPackages = with pkgs; [ mergerfs ]; environment.systemPackages = with pkgs; [ mergerfs mergerfs-tools ];
fileSystems."/mnt/disk1" = { fileSystems."/mnt/disk1" = {
fsType = "ext4"; fsType = "ext4";
@ -57,11 +57,4 @@
"category.create=mfs" "category.create=mfs"
]; ];
}; };
services.nfs.server = {
enable = true;
exports = ''
/mnt/storage *(rw,async,no_subtree_check,fsid=0,all_squash,anonuid=0,anongid=0)
'';
};
} }