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 = [ packages = [ start-services ];
start-services
pkgs.htop # Enable support for primary RAID array
]; raid.sapana.enable = true;
# Change how long old generations are kept for. # Change how long old generations are kept for.
retentionPeriod = "30d"; retentionPeriod = "30d";

View file

@ -28,15 +28,6 @@ in
kernelModules = [ "kvm-intel" ]; kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ]; 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 # Enable support for building ARM64 packages
binfmt.emulatedSystems = [ "aarch64-linux" ]; binfmt.emulatedSystems = [ "aarch64-linux" ];
}; };

View file

@ -45,6 +45,9 @@ in
# Enable GPU support. # Enable GPU support.
gpu.intel.enable = true; 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. # Change how long old generations are kept for.
retentionPeriod = "14d"; retentionPeriod = "14d";

View file

@ -55,6 +55,9 @@ in
keepassxc # Use native instead of Flatpak due to weird performance issues 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. # Keep old generations for two weeks.
retentionPeriod = "14d"; retentionPeriod = "14d";

View file

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