move filesystem imports to module level
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
./program-tmux.nix
|
./program-tmux.nix
|
||||||
|
|
||||||
# Hardware
|
# Hardware
|
||||||
./nfs-mount.nix
|
|
||||||
./hwaccel.nix
|
./hwaccel.nix
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
@@ -31,20 +30,19 @@
|
|||||||
++ lib.optionals (config.vars.host_type == "nas") [ ./service-zrepl.nix ]
|
++ lib.optionals (config.vars.host_type == "nas") [ ./service-zrepl.nix ]
|
||||||
++ lib.optionals (config.vars.host_type == "worker") [ ./nfs-mount.nix ./keepalived.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.systemd-boot.enable = true;
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
# boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
|
||||||
boot.supportedFilesystems = [ "nfs" ]; # "zfs"
|
# Enable IP forwarding for NAT (used in wireguard.nix) and load specific modules.
|
||||||
boot.kernel.sysctl = { "net.ipv4.ip_forward" = 1; };
|
boot.kernel.sysctl = {
|
||||||
boot.kernel.sysctl = { "net.ipv6.conf.all.forwarding" = 1; };
|
"net.ipv4.ip_forward" = 1;
|
||||||
|
"net.ipv6.conf.all.forwarding" = 1;
|
||||||
|
};
|
||||||
boot.kernelModules = [ "rbd" "nbd" ];
|
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.hostName = config.vars.hostname;
|
||||||
networking.hostId = config.vars.hostid; # Define your hostID - Needs to be unique!.
|
networking.hostId = config.vars.hostid;
|
||||||
networking = {
|
networking = {
|
||||||
interfaces = let
|
interfaces = let
|
||||||
primaryInterface = lib.head config.vars.interfaces;
|
primaryInterface = lib.head config.vars.interfaces;
|
||||||
@@ -63,7 +61,7 @@
|
|||||||
|
|
||||||
networking.defaultGateway = {
|
networking.defaultGateway = {
|
||||||
address = "192.168.178.1";
|
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" ];
|
networking.nameservers = [ "192.168.178.10" "9.9.9.9" ];
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
{ config, pkgs, ... }: {
|
{ config, pkgs, ... }: {
|
||||||
|
|
||||||
|
# Add ZFS and NFS support to the initramfs so it can be mounted at boot.
|
||||||
|
boot.supportedFilesystems = [ "nfs" ];
|
||||||
|
|
||||||
systemd.mounts = [{
|
systemd.mounts = [{
|
||||||
type = "nfs";
|
type = "nfs";
|
||||||
@@ -15,5 +18,6 @@
|
|||||||
TimeoutIdleSec = "600";
|
TimeoutIdleSec = "600";
|
||||||
};
|
};
|
||||||
where = config.vars.nfs_mount;
|
where = config.vars.nfs_mount;
|
||||||
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,4 +36,6 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.zrepl ];
|
environment.systemPackages = [ pkgs.zrepl ];
|
||||||
|
services.nfs.server.enable = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
46
zfs-management.nix
Normal file
46
zfs-management.nix
Normal 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";
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user