services: add new nas nfs share

This commit is contained in:
Kabbone 2023-01-07 19:43:12 +01:00
parent 78a120c99b
commit 845a69089b
Signed by: Kabbone
SSH Key Fingerprint: SHA256:A5zPB5I6u5V78V51c362BBdCwhDhfDUVbt7NfKdjWBY
5 changed files with 66 additions and 2 deletions

View File

@ -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 = [ ];

View File

@ -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

View File

@ -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;
};

View File

@ -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

17
modules/services/nfs.nix Normal file
View File

@ -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 ];
};
};
}