From 95944b2486b98df6f57c526e68fe5b7f45cd18fd Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 20 Feb 2024 20:22:41 +0100 Subject: [PATCH] Added vatnajokull NAS as a separate module --- hosts/reykjavik/default.nix | 2 ++ hosts/reykjavik/hardware.nix | 7 ------- hosts/thingvellir/default.nix | 1 + hosts/thingvellir/hardware.nix | 7 ------- modules/server/vatnajokull.nix | 21 +++++++++++++++++++++ 5 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 modules/server/vatnajokull.nix diff --git a/hosts/reykjavik/default.nix b/hosts/reykjavik/default.nix index 933593d..d806763 100644 --- a/hosts/reykjavik/default.nix +++ b/hosts/reykjavik/default.nix @@ -63,6 +63,8 @@ in system.pass.enable = true; system.sshfs.enable = true; + server.vatnajokull.enable = true; + # - Desktop ---------------------------------- desktop = { inherit wallpaper; diff --git a/hosts/reykjavik/hardware.nix b/hosts/reykjavik/hardware.nix index 0ddcc60..4f23117 100644 --- a/hosts/reykjavik/hardware.nix +++ b/hosts/reykjavik/hardware.nix @@ -22,13 +22,6 @@ device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; }; - - "/mnt/vatnajokull" = { - device = "vatnajokull:/mnt/raid1"; - fsType = "nfs"; - options = [ "x-systemd.automount" "noauto" "noatime" "x-systemd.idle-timeout=600"]; - }; - }; swapDevices = [ diff --git a/hosts/thingvellir/default.nix b/hosts/thingvellir/default.nix index 3136de7..c077e95 100644 --- a/hosts/thingvellir/default.nix +++ b/hosts/thingvellir/default.nix @@ -61,6 +61,7 @@ with lib; server = true; host-config = ../../config/nomad.d/host-thingvellir.hcl; }; + server.vatnajokull.enable = true; # - Editors and development ------------------ dev.git.userName = "marc"; diff --git a/hosts/thingvellir/hardware.nix b/hosts/thingvellir/hardware.nix index c10e2ac..8d24782 100644 --- a/hosts/thingvellir/hardware.nix +++ b/hosts/thingvellir/hardware.nix @@ -17,13 +17,6 @@ device = "/dev/disk/by-label/nixos"; fsType = "ext4"; }; - - "/mnt/vatnajokull" = { - # device = "vatnajokull:/mnt/raid1"; - device = "100.89.248.65:/mnt/raid1"; - fsType = "nfs"; - options = [ "x-systemd.automount" "noauto" "noatime" "x-systemd.idle-timeout=600"]; - }; }; swapDevices = [ diff --git a/modules/server/vatnajokull.nix b/modules/server/vatnajokull.nix new file mode 100644 index 0000000..2402f70 --- /dev/null +++ b/modules/server/vatnajokull.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, self, ... }: + +let + vatnajokull-ip = "100.89.248.65"; + cfg = config.samfelag.modules.server.vatnajokull; +in +{ + options.samfelag.modules.server.vatnajokull = { + enable = lib.mkEnableOption "Vatnajokull NAS"; + }; + config = lib.mkIf cfg.enable { + + fileSystems = { + "/mnt/vatnajokull" = { + device = "${vatnajokull-ip}:/mnt/raid1"; + fsType = "nfs"; + options = [ "x-systemd.automount" "noauto" "noatime" "x-systemd.idle-timeout=600"]; + }; + }; + }; +}