move filesystem imports to module level

This commit is contained in:
2025-07-16 23:20:28 +02:00
parent 57ba310000
commit 21e54d968e
4 changed files with 62 additions and 12 deletions

View File

@@ -20,7 +20,6 @@
./program-tmux.nix
# Hardware
./nfs-mount.nix
./hwaccel.nix
# Services
@@ -31,20 +30,19 @@
++ lib.optionals (config.vars.host_type == "nas") [ ./service-zrepl.nix ]
++ lib.optionals (config.vars.host_type == "worker") [ ./nfs-mount.nix ./keepalived.nix ];
# Use the systemd-boot EFI boot loader and enable that sweet zfs stuff.
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
boot.supportedFilesystems = [ "nfs" ]; # "zfs"
boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; };
boot.kernel.sysctl = { "net.ipv6.conf.all.forwarding" = 1; };
boot.kernelModules = [ "rbd" "nbd" ];
# boot.zfs.forceImportRoot = false;
# boot.zfs.extraPools = [ "SERVICE" ];
# services.zfs.autoScrub.enable = true;
networking.hostName = config.vars.hostname; # Define your hostname.
networking.hostId = config.vars.hostid; # Define your hostID - Needs to be unique!.
# Enable IP forwarding for NAT (used in wireguard.nix) and load specific modules.
boot.kernel.sysctl = {
"net.ipv4.ip_forward" = 1;
"net.ipv6.conf.all.forwarding" = 1;
};
boot.kernelModules = [ "rbd" "nbd" ];
networking.hostName = config.vars.hostname;
networking.hostId = config.vars.hostid;
networking = {
interfaces = let
primaryInterface = lib.head config.vars.interfaces;
@@ -63,7 +61,7 @@
networking.defaultGateway = {
address = "192.168.178.1";
interface = lib.head config.vars.interfaces;
interface = lib.head config.vars.interfaces; # Sticking with the primary interface
};
networking.nameservers = [ "192.168.178.10" "9.9.9.9" ];

View File

@@ -1,5 +1,8 @@
{ config, pkgs, ... }: {
# Add ZFS and NFS support to the initramfs so it can be mounted at boot.
boot.supportedFilesystems = [ "nfs" ];
systemd.mounts = [{
type = "nfs";
mountConfig = {
@@ -15,5 +18,6 @@
TimeoutIdleSec = "600";
};
where = config.vars.nfs_mount;
}];
}

View File

@@ -36,4 +36,6 @@
};
environment.systemPackages = [ pkgs.zrepl ];
services.nfs.server.enable = true;
}

46
zfs-management.nix Normal file
View File

@@ -0,0 +1,46 @@
{ config, pkgs, ... }:
{
# Add ZFS and NFS support to the initramfs so it can be mounted at boot.
boot.supportedFilesystems = [ "zfs" "nfs" ];
# boot.zfs.enableUnstable = true;
boot.zfs.forceImportRoot = false;
# boot.zfs.extraPools = [ "DATA" ];
services.zfs.autoScrub.enable = true;
# Enable and configure zrepl service
environment.systemPackages = [ pkgs.zrepl ];
services.zrepl = {
enable = true;
settings = {
global = {
logging = [{
# use syslog instead of stdout because it makes journald happy
type = "syslog";
format = "human";
level = "info";
}];
};
jobs = [{
type = "source";
name = "pullsource";
send = {
encrypted = true;
};
serve = {
type = "stdinserver";
client_identities = [ "siredward" ];
};
filesystems = {
"SERVICE/volumes" = true;
};
snapshotting = {
type = "periodic";
prefix = "SN_";
interval = "1h";
};
}];
};
};
}