diff --git a/hosts/desktop/hardware-configuration.nix b/hosts/desktop/hardware-configuration.nix index 1cc4ddb..abe9de0 100644 --- a/hosts/desktop/hardware-configuration.nix +++ b/hosts/desktop/hardware-configuration.nix @@ -71,6 +71,12 @@ options = [ "noauto,users,x-systemd.automount,x-systemd.device-timeout=10,soft,timeo=14,x-systemd.idle-timeout=1min,sec=sys,exec" ]; }; + fileSystems."/mnt/Pluto" = + { device = "nas:/mnt/Pluto"; + fsType = "nfs"; + options = [ "noauto,users,x-systemd.automount,x-systemd.device-timeout=10,soft,timeo=14,x-systemd.idle-timeout=1min,sec=sys,exec" ]; + }; + swapDevices = [ ]; diff --git a/hosts/nas/default.nix b/hosts/nas/default.nix index dfdc9ae..276d5a3 100644 --- a/hosts/nas/default.nix +++ b/hosts/nas/default.nix @@ -23,7 +23,7 @@ imports = # For now, if applying to other system, swap files [(import ./hardware-configuration.nix)] ++ # Current system hardware config @ /etc/nixos/hardware-configuration.nix #[(import ../../modules/desktop/virtualisation/docker.nix)] ++ # Docker - #(import ../../modules/services/nas) ++ # Server Services + (import ../../modules/services/nas) ++ # Server Services (import ../../modules/hardware); # Hardware devices boot = { # Boot options diff --git a/hosts/nas/hardware-configuration.nix b/hosts/nas/hardware-configuration.nix index 644713c..2d06d96 100644 --- a/hosts/nas/hardware-configuration.nix +++ b/hosts/nas/hardware-configuration.nix @@ -54,11 +54,34 @@ options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nix,discard=async" ]; }; + fileSystems."/mnt/Pluto" = + { device = "/dev/disk/by-label/NAS-RAID"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,noatime,subvol=@" ]; + }; + + fileSystems."/mnt/Mars" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "btrfs"; + options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nas,discard=async" ]; + }; + fileSystems."/boot" = { device = "/dev/disk/by-label/NIXBOOT"; fsType = "vfat"; }; + fileSystems."/export/Pluto" = + { device = "/mnt/Pluto"; + options = [ "bind" ]; + }; + + fileSystems."/export/Mars" = + { device = "/mnt/Mars"; + options = [ "bind" ]; + }; + + fileSystems."/mnt/Herkules" = { device = "truenas:/mnt/Herkules"; fsType = "nfs"; @@ -77,7 +100,7 @@ networking = { useDHCP = false; # Deprecated hostName = "nas"; - domain = "kabtop.de"; + domain = "home.opel-online.de"; networkmanager = { enable = false; }; diff --git a/modules/services/nas/default.nix b/modules/services/nas/default.nix new file mode 100644 index 0000000..a41a063 --- /dev/null +++ b/modules/services/nas/default.nix @@ -0,0 +1,18 @@ +# +# Services +# +# flake.nix +# ├─ ./hosts +# │ └─ home.nix +# └─ ./modules +# └─ ./services +# └─ default.nix * +# └─ ... +# + +[ + ./nfs.nix +] + +# picom, polybar and sxhkd are pulled from desktop module +# redshift temporarely disables diff --git a/modules/services/nfs.nix b/modules/services/nfs.nix new file mode 100644 index 0000000..04e67d8 --- /dev/null +++ b/modules/services/nfs.nix @@ -0,0 +1,17 @@ +{config, pkgs, lib, ...}: { + # enable nfs + services.nfs.server = rec { + enable = true; + exports = '' + /export 192.168.2.0/24(rw,fsid=0,no_subtree_check) + /export/Pluto 192.168.2.0/24(rw,no_subtree_check) + /export/Mars 192.168.2.0/24(rw,no_subtree_check) + ''; + }; + # open the firewall + networking.firewall = { + interfaces.enp0s31f6 = { + allowedTCPPorts = [ 2049 ]; + }; + }; +}