1
0
Fork 0

System: Make RAID a common module and allow other systems to mount it

This commit is contained in:
Aires 2024-08-29 09:14:27 -04:00
parent bc0103686a
commit 50e116bca7
6 changed files with 38 additions and 13 deletions

View file

@ -96,10 +96,10 @@ in
};
};
packages = [
start-services
pkgs.htop
];
packages = [ start-services ];
# Enable support for primary RAID array
raid.sapana.enable = true;
# Change how long old generations are kept for.
retentionPeriod = "30d";

View file

@ -28,15 +28,6 @@ in
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
# Enable mdadm for Sapana (RAID 5 primary storage).
swraid = {
enable = true;
mdadmConf = ''
ARRAY /dev/md/Sapana metadata=1.2 UUID=51076daf:efdb34dd:bce48342:3b549fcb
MAILADDR ${config.secrets.users.aires.email}
'';
};
# Enable support for building ARM64 packages
binfmt.emulatedSystems = [ "aarch64-linux" ];
};

View file

@ -45,6 +45,9 @@ in
# Enable GPU support.
gpu.intel.enable = true;
# Enable support for primary RAID array (just in case)
raid.sapana.enable = true;
# Change how long old generations are kept for.
retentionPeriod = "14d";

View file

@ -55,6 +55,9 @@ in
keepassxc # Use native instead of Flatpak due to weird performance issues
];
# Enable support for primary RAID array (just in case)
raid.sapana.enable = true;
# Keep old generations for two weeks.
retentionPeriod = "14d";

View file

@ -15,6 +15,8 @@
aux.system = {
packages = with pkgs; [
fastfetch # Show a neat system statistics screen when opening a terminal
htop
mdadm # RAID management
nh # Nix Helper: https://github.com/viperML/nh
zellij # Terminal multiplexer
];

26
modules/system/raid.nix Normal file
View file

@ -0,0 +1,26 @@
# Configures bluetooth.
{ lib, config, ... }:
let
cfg = config.aux.system.raid;
in
{
options = {
aux.system.raid = {
enable = lib.mkEnableOption "Enables RAID support.";
sapana.enable = lib.mkEnableOption "Enables support for the Sapana/storage array.";
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable { boot.swraid.enable = true; })
(lib.mkIf cfg.sapana.enable {
aux.system.raid.enable = true;
boot.swraid.mdadmConf = ''
ARRAY /dev/md/Sapana metadata=1.2 UUID=51076daf:efdb34dd:bce48342:3b549fcb
MAILADDR ${config.secrets.users.aires.email}
'';
})
];
}