diff --git a/hosts/common/optional/nfs.nix b/hosts/common/optional/nfs.nix new file mode 100644 index 0000000..636e3ec --- /dev/null +++ b/hosts/common/optional/nfs.nix @@ -0,0 +1,21 @@ +# hosts/common/optional/nfs.nix +{...}: { + # Enable NFS server + services.nfs.server = { + enable = true; + + # Define your exports + exports = '' + /nas 192.168.2.101(rw,sync,no_root_squash,no_subtree_check) 100.0.0.0/8(rw,sync,no_root_squash,no_subtree_check) + ''; + + # Enable NFSv4 (recommended) + # Remove this line if you need to stick with NFSv2/v3 only + createMountPoints = true; + }; + + # Ensure the directories exist + systemd.tmpfiles.rules = [ + "d /nas 0755 root root -" + ]; +} diff --git a/hosts/tatara/default.nix b/hosts/tatara/default.nix index d829c79..c44cb10 100644 --- a/hosts/tatara/default.nix +++ b/hosts/tatara/default.nix @@ -12,15 +12,24 @@ # Common configurations ../common/global ../common/optional/docker.nix + + ../common/optional/nfs.nix ]; # Bootloader boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + boot.supportedFilesystems = ["zfs"]; + boot.zfs.extraPools = ["nas"]; + + services.zfs.autoScrub.enable = true; + services.zfs.trim.enable = true; + # Networking networking = { hostName = "tatara"; + hostId = "b47100bc"; networkmanager.enable = true; useDHCP = lib.mkDefault true; }; diff --git a/hosts/tatara/hardware-configuration.nix b/hosts/tatara/hardware-configuration.nix index 84462df..9842724 100644 --- a/hosts/tatara/hardware-configuration.nix +++ b/hosts/tatara/hardware-configuration.nix @@ -1,30 +1,34 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.supportedFilesystems = ["zfs"]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/057be728-a74c-4a73-b102-247aba6155a7"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/057be728-a74c-4a73-b102-247aba6155a7"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/7B70-EE8A"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/7B70-EE8A"; + fsType = "vfat"; + options = ["fmask=0077" "dmask=0077"]; + }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's