big restructure, getting there prayers for rebuild

This commit is contained in:
2025-10-13 21:29:04 -05:00
parent 9128bf3d66
commit c02dafd0d1
26 changed files with 82 additions and 63 deletions

View File

@@ -0,0 +1,13 @@
{
pkgs,
config,
lib,
...
}: {
# services show up in glance in reverse import order lmao
imports = [
./shares/nfs.nix
./shares/smb.nix
./shares/zfs.nix
];
}

View File

@@ -0,0 +1,28 @@
{
pkgs,
config,
lib,
...
}:
# define nfs exports
let
cfg = config.modules.fileshare.nfs;
nfs_exports = ''
/holocron/media *(ro,sync,no_subtree_check)
'';
#/holocron/vault *(rw,sync,no_subtree_check,no_root_squash)
in {
options.modules.homelab.nfs = {
enable = lib.mkEnableOption "enables nfs";
};
config = lib.mkIf cfg.enable {
# enable nfs with all exports
services.nfs = {
server = {
enable = true;
exports = nfs_exports;
};
};
};
}

View File

@@ -0,0 +1,36 @@
{
pkgs,
config,
lib,
...
}:
# define smb shares
let
cfg = config.modules.fileshare.smb;
smb_shares = {
vault = {
path = "/holocron/vault";
browseable = true;
writable = true;
guestOk = false;
};
media = {
path = "/holocron/media";
browseable = true;
writable = true;
guestOk = false;
};
};
in {
options.modules.homelab.smb = {
enable = lib.mkEnableOption "enables smb";
};
config = lib.mkIf cfg.enable {
# enable smb with all shares
services.samba = {
enable = true;
settings = smb_shares;
};
};
}

View File

@@ -0,0 +1,36 @@
{
pkgs,
config,
lib,
...
}: let
cfg = config.modules.fileshare.zfs;
in {
options.modules.homelab.zfs = {
enable = lib.mkEnableOption "enables zfs";
};
config = lib.mkIf cfg.enable {
# set network host id
networking.hostId = "3e6e7055";
# enable zfs support
boot.kernelModules = ["zfs"];
boot.supportedFilesystems = ["zfs"];
# enable smart monitoring
services.smartd.enable = true;
# enable zfs
services.zfs = {
autoScrub.enable = true;
autoScrub.interval = "weekly";
};
fileSystems."/holocron" = {
device = "holocron";
fsType = "zfs";
options = ["nofail"];
};
};
}