From d67dbd92d0042a92cfa8e18550492007b351cbd6 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sat, 21 Mar 2026 22:26:09 -0400 Subject: [PATCH] latest --- bin/skyg | 14 ++++++++---- hosts/hl-bigbox2.nix | 26 +++++++++++++++++---- hosts/hl-terra1.nix | 2 +- modules/network-drives.nix | 47 ++++++++++++++++++++++++++------------ 4 files changed, 64 insertions(+), 25 deletions(-) diff --git a/bin/skyg b/bin/skyg index 490bbd6..3ffc7f0 100755 --- a/bin/skyg +++ b/bin/skyg @@ -20,6 +20,10 @@ def main [] { help main } +def "main profiles" [] { + valid_profiles | print +} + # Build configuration def "main build" [] { nh os build | print @@ -56,10 +60,10 @@ def "main update" [input_name:string = ""] { def "main remote" [cmd:string, target:string = ""] { mut target_host = $"root@($target).lab.internal" mut profile = $"hl-($target)" - if not (is-valid-profile $profile) { - print $"Invalid Profile ($profile), please select one of:" - return valid_profiles - } + # if not (is-valid-profile $profile) { + # print $"Invalid Profile ($profile), please select one of:" + # return valid_profiles + # } $"Using [($profile)]" | print const valid_cmds = [ "test" , "dry-activate" , "run" , "switch" , "build" @@ -69,7 +73,7 @@ def "main remote" [cmd:string, target:string = ""] { return $valid_cmds } $"($cmd) on ($target_host) with ($profile)" | print - mut runcmd = $"nixos-rebuild ($cmd) --target-host ($target_host) --use-remote-sudo --flake .#($profile)" + mut runcmd = $"nixos-rebuild ($cmd) --target-host ($target_host) --sudo --flake .#($profile)" $runcmd | print bash -c $runcmd } diff --git a/hosts/hl-bigbox2.nix b/hosts/hl-bigbox2.nix index ad1b5db..f173401 100644 --- a/hosts/hl-bigbox2.nix +++ b/hosts/hl-bigbox2.nix @@ -2,7 +2,11 @@ let ports = { nixServe = 5000; + lockdPort = 4001; + mountdPort = 4002; + statdPort = 4000; }; +openPorts = builtins.attrValues ports; in { skyg = { @@ -16,11 +20,23 @@ in enable = true; }; }; - services.nix-serve = { - enable = true; - secretKeyFile = "/home/ari/cache-keys/bigbox2.lab.internal.private"; - port = ports.nixServe; - }; + # services.nix-serve = { + # enable = true; + # secretKeyFile = "/home/ari/cache-keys/bigbox2.lab.internal.private"; + # port = ports.nixServe; + # }; # firmware updater services.fwupd.enable = true; + services.nfs.server = { + enable = true; + lockdPort = ports.lockdPort; + mountdPort = ports.mountdPort; + statdPort = ports.statdPort; + extraNfsdConfig = ''''; + exports = '' + /data/fourTerra 10.0.0.0/16(rw,wdelay,insecure,no_root_squash,no_subtree_check,sec=sys,rw,insecure,no_root_squash,no_all_squash) + ''; + }; + networking.firewall.allowedUDPPorts = openPorts; + networking.firewall.allowedTCPPorts = openPorts; } diff --git a/hosts/hl-terra1.nix b/hosts/hl-terra1.nix index 96eb890..f17552f 100644 --- a/hosts/hl-terra1.nix +++ b/hosts/hl-terra1.nix @@ -1,6 +1,6 @@ { pkgs, ... }: let - openPorts = [ + openPorts = [ # nfs 111 2049 diff --git a/modules/network-drives.nix b/modules/network-drives.nix index ab327cc..89c6835 100644 --- a/modules/network-drives.nix +++ b/modules/network-drives.nix @@ -4,19 +4,38 @@ }: let cfg = config.skyg.networkDrives; + makeCommonOption = {defaultHost, enabledByDefault ? true} : lib.mkOption { + type = lib.types.submodule { + options = { + enabled = lib.mkOption { + type = lib.types.bool; + default = enabledByDefault; + }; + host = lib.mkOption { + type = lib.types.str; + default = defaultHost; + }; + }; + }; + default = { + enabled = enabledByDefault; + host = defaultHost; + }; + }; in { options = { skyg.networkDrives = { enable = lib.mkEnableOption "Network Drives"; - tnasHost = lib.mkOption { - type = lib.types.str; - default = "tnas1.lab.internal"; + tnas1 = makeCommonOption { + defaultHost = "tnas1.lab.internal"; }; - terraHost = lib.mkOption { - type = lib.types.str; - default = "terra1.lab.internal"; + terra1 = makeCommonOption { + defaultHost = "terra1.lab.internal"; + }; + bigBox2 = makeCommonOption { + defaultHost = "bigbox2.lab.internal"; }; options = lib.mkOption { type = lib.types.listOf lib.types.str; @@ -30,26 +49,26 @@ in }; }; config = lib.mkIf cfg.enable { - fileSystems."/torrents" = { - device = "${cfg.tnasHost}:/mnt/EightTerra/DownloadedTorrents"; + fileSystems."/torrents" = lib.mkIf cfg.tnas1.enabled { + device = "${cfg.tnas1.host}:/mnt/EightTerra/DownloadedTorrents"; fsType = "nfs"; options = cfg.options; }; - fileSystems."/mnt/EightTerra/k3s-cluster" = { - device = "${cfg.tnasHost}:/mnt/EightTerra/k3s-cluster"; + fileSystems."/mnt/EightTerra/k3s-cluster" = lib.mkIf cfg.tnas1.enabled { + device = "${cfg.tnas1.host}:/mnt/EightTerra/k3s-cluster"; fsType = "nfs"; options = cfg.options; }; - fileSystems."/mnt/OneT/NVR" = { - device = "${cfg.tnasHost}:/mnt/OneT/NVR"; + fileSystems."/mnt/OneT/NVR" = lib.mkIf cfg.tnas1.enabled { + device = "${cfg.tnas1.host}:/mnt/OneT/NVR"; fsType = "nfs"; options = cfg.options; }; - fileSystems."/mnt/terra1/Data/apps" = { - device = "${cfg.terraHost}:/mnt/Data/apps"; + fileSystems."/mnt/terra1/Data/apps" = lib.mkIf cfg.terra1.enabled { + device = "${cfg.terra1.host}:/mnt/Data/apps"; fsType = "nfs"; options = cfg.options; };