From 33503c448574985850dc863bbef1f0a75d11b992 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 11:31:45 +0100 Subject: [PATCH 1/7] chatterino update --- git-crypt/secrets.nix | Bin 3490 -> 3490 bytes home-modules/chatterino.nix | 1 - 2 files changed, 1 deletion(-) diff --git a/git-crypt/secrets.nix b/git-crypt/secrets.nix index c616a1ed376884e9aba07cc13d7496f86fd9a235..72f70170f844ba72878777aab4baac681b28e9d8 100644 GIT binary patch literal 3490 zcmZQ@_Y83kiVO&05ME}XZMkXUhff#eIr+4FKX^Pn{q*tn=V{XyKQPp)vk+u|Df|5m zWB0cV>FsR6pKaH8Ol?To;^4QZBd+hl`?Jbd`j$@pSkSHCd^=j|^t<&Nm#G@XHw7ww zH9K?Q^gR8;%dd8%uVP_ZY%uHQ@{?N5*^_cUnDu-*WuZhIn#Oo>Z~e-1ckXx`d$Ez%p;Y+LuM;zt`N;8b2(1xb zFMU~=z0)s!UGbLlFLN&5*>8C_w9JK5L%l76yVpJcU&AK7*^DY(|M_P;^inL?rI=Kp z6M1e0zk@7GoMKM#w5NyTwyfWA*i3e%#f+G9%M%)k7G29c_0Ma{Gn;j#G2+|yW!X-~|7YC~_ttZBMU{5H zZ3^(*e$FuHQ>yblRP_zr?c>r#Y%Vm--kd$h z@bpBEoj(qqlc~x~uK0M7!C*$1`OSl_MrWUG_O!HUELkP_z(l`YDTh^ZvT(wGMFHpZ zD8c6WOUrt_eBblV^IX#^zWj!Y55uf3rP@_Z6BT|h(>SQRpfX41nc^q6EpJNC?^hCf zUN+z3uHb>+UsmyoE%|&+ZR0kZy;3udSnUznC;fS1RWsYIl_8;>ca*mMnb~&V_0h3A z>yG|hYBm4wE3V~}1(z+_{JL1YG-A`eZ+_C85{;7CVvDb+e13hXv`=?#&%+$S+Zw)k z^+I>&zjodK^v9-&ySrXirHY0xcS!F!C3z)#?F0V@QSAkbWw)OA{;7IKdINVMr_Z_z z(-+wYHN1G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o_$<90xV8@KCA`5bY# zqyMK_99j2!(?mgsPnT!i+QYpw|H8pr`}V7z`;=`iwfvX8-o&_o2YfH)%_*L!Cs63u zkuJhCami8#5w(Cxq3(XyqkZRY>l5banz_U|{qUSr_hWvG&Pd9C_{8=?-C0M>dPaG7 z+d9kbBJY2t@8b?q40^Co?dWT3-t5JTcFIq`ywlQiiP#SgPww(p77-4s}) zIm7BC(>WcrTn8OSm7j+m8+|Kw^gEPU?Q)zWdGgm)8>juVcUW(J_d{{?^h(p$2YyUj ztz&Y3N@MxPi2C@)eDW_07D&%EC~p3-bJ4{Ew_Q@B_@$%wom)0hXr8d3>*|i%E8gfN zzW(U4@T7$4>YMQsi+5yp%@o<0=FQ5P#vT~m7dLzLY~R3)n2-BoKYaP=T_EkF{c`p9 zB@6l1e7MFi^MuwXn-y7cFBb3Aw^nh&KW~B6od0i3xesJth=|MH uEito_v#oM@zLUdhf#b8M2`|u)7uaT{>cRV{ukwfttKUDp^z9LT1}^~m-@2Os diff --git a/home-modules/chatterino.nix b/home-modules/chatterino.nix index 2c81f7d..96478bb 100644 --- a/home-modules/chatterino.nix +++ b/home-modules/chatterino.nix @@ -16,7 +16,6 @@ let "LEC" "lol_nemesis" "NASA" - "NNOPrime" "NoWay4u_Sir" "OfficialMikeShinoda" "Rekkles" From 3ed506a9245f2581ad129cdb0db0fcc7c431e5ca Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 11:31:55 +0100 Subject: [PATCH 2/7] handball wm is over --- home-modules/calendar.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/home-modules/calendar.nix b/home-modules/calendar.nix index c728d35..a9bc358 100644 --- a/home-modules/calendar.nix +++ b/home-modules/calendar.nix @@ -40,13 +40,13 @@ read-only = true; type = "ics"; } - { - name = "Handball Männer"; - url = "http://i.cal.to/ical/108/dhb/handball-nationalmannschaft/c687e97f.bc7c3eb6-11a0e356.ics"; - color = "#880023"; - read-only = true; - type = "ics"; - } + # { + # name = "Handball Männer"; + # url = "http://i.cal.to/ical/108/dhb/handball-nationalmannschaft/c687e97f.bc7c3eb6-11a0e356.ics"; + # color = "#880023"; + # read-only = true; + # type = "ics"; + # } ]; default_set = { # name = From e5e7164a932f0740ff4282076d85539fd15ee6a6 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 11:32:18 +0100 Subject: [PATCH 3/7] force reload event hotkey --- home-modules/hyprland.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-modules/hyprland.nix b/home-modules/hyprland.nix index 50aaa01..78df2cb 100644 --- a/home-modules/hyprland.nix +++ b/home-modules/hyprland.nix @@ -349,7 +349,7 @@ in { "SUPER SHIFT, F1, movetoworkspace, 100" # "SUPER, F2," # "SUPER, F3, toggleopaque" - # "SUPER, F4," + "SUPER, F4, exec, rm /tmp/caldav_event_cache.json && notify-send Saved event deleted!" "SUPER, F5, exec, nx_gcal_event force-lookup" "SUPER SHIFT, F5, exec, nx_gcal_event reauthenticate" "SUPER, F6, exec, ${terminal-exec}'htop'" From 73281b62d94ecf12f9db7f4a965929316fe0074a Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 11:33:03 +0100 Subject: [PATCH 4/7] yazi orphans --- home-modules/yazi.nix | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/home-modules/yazi.nix b/home-modules/yazi.nix index 1f55cc7..c175115 100644 --- a/home-modules/yazi.nix +++ b/home-modules/yazi.nix @@ -34,8 +34,8 @@ { on = ""; run = "arrow 100%"; desc = "Move cursor down one page"; } { on = ""; run = "arrow -100%"; desc = "Move cursor up one page"; } { on = ""; run = "arrow 100%"; desc = "Move cursor down one page"; } - { on = [ "g" "g" ]; run = "arrow -99999999"; desc = "Move cursor to the top"; } - { on = [ "g" "e" ]; run = "arrow 99999999"; desc = "Move cursor to the end"; } + { on = [ "g" "g" ]; run = "arrow down"; desc = "Move cursor to the top"; } + { on = [ "g" "e" ]; run = "arrow up"; desc = "Move cursor to the end"; } { on = [ "g" "h" ]; run = "cd ~"; desc = "Go to the home directory"; } { on = [ "g" "n" ]; run = "cd ~/nix-dots"; desc = "Go to the Nix-Dotfiles directory"; } { on = [ "g" "n" ]; run = "cd /nix/store"; desc = "Go to the Nix-Store"; } @@ -205,38 +205,38 @@ { run = ''unzip "$1"''; desc = "unzip"; } ]; "image" = [ - { run = ''imv "$@"''; desc = "imv"; } - { run = ''gimp "$@"''; desc = "gimp"; } + { run = ''imv "$@"''; desc = "imv"; orphan = true; } + { run = ''gimp "$@"''; desc = "gimp"; orphan = true; } { run = ''swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120 "$@"''; desc = "swww wallpaper"; } { run = ''exiftool "$@"; echo "Press enter to exit"; read''; desc = "View Exif Data"; } { run = ''for f in "$@"; do magick "$f" -auto-orient "''${f%.*}.pdf"; done''; desc = "Convert to PDF"; } ]; "svg" = [ - { run = ''inkscape "$@"''; desc = "inkscape";} - { run = ''firefox "$@"''; desc = "firefox";} + { run = ''inkscape "$@"''; desc = "inkscape"; orphan = true; } + { run = ''firefox "$@"''; desc = "firefox"; orphan = true; } ]; "font" = [ - { run = ''fontpreview "$@"''; desc = "fontpreview"; } - { run = ''fontforge "$@"''; desc = "fortforge"; } + { run = ''fontpreview "$@"''; desc = "fontpreview"; orphan = true; } + { run = ''fontforge "$@"''; desc = "fortforge"; orphan = true; } ]; "document" = [ - { run = ''zathura "$@"''; desc = "zathura"; orphan = true; } - { run = ''xournal "$@"''; desc = "xournal"; orphan = true; } - { run = ''firefox "$@"''; desc = "firefox"; } + { run = ''zathura "$@"''; desc = "zathura"; orphan = true; } + { run = ''xournal "$@"''; desc = "xournal"; orphan = true; } + { run = ''firefox "$@"''; desc = "firefox"; orphan = true; } { run = ''nxgs flip "$@"''; desc = "nxgs flip"; } { run = ''nxgs rotate "$@"''; desc = "nxgs rotate"; } { run = ''nxgs interactive-merge "$@"''; block = true; desc = "nxgs merge"; } ]; "browser" = [ - { run = ''firefox "$@"''; desc = "firefox"; } - { run = ''zen "$@"''; desc = "zen"; } - { run = ''chromium --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"''; desc = "chromium"; } + { run = ''firefox "$@"''; desc = "firefox"; orphan = true; } + { run = ''zen "$@"''; desc = "zen"; orphan = true; } + { run = ''chromium --enable-features=UseOzonePlatform --ozone-platform=wayland "$@"''; desc = "chromium"; orphan = true; } { run = ''w3m "$@"''; desc = "w3m"; } { run = ''lynx "$@"''; desc = "lynx"; } ]; "office" = [ - { run = ''libreoffice "$@"''; desc = "libreoffice"; } - { run = ''libreoffice --view "$@"''; desc = "libreoffice read-only"; } + { run = ''libreoffice "$@"''; desc = "libreoffice"; orphan = true; } + { run = ''libreoffice --view "$@"''; desc = "libreoffice read-only"; orphan = true; } ]; "shell" = [ { run = ''bash -c "$@"''; desc = "bash -c"; } From 60a839663a6ab753e1fb1f4eca0eba4027be7a32 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 11:33:43 +0100 Subject: [PATCH 5/7] radicale fix --- system-modules/nx2site/radicale.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-modules/nx2site/radicale.nix b/system-modules/nx2site/radicale.nix index 65619f5..b98635d 100644 --- a/system-modules/nx2site/radicale.nix +++ b/system-modules/nx2site/radicale.nix @@ -1,7 +1,7 @@ { config, domain, ... }: { sops.secrets = { - "nx2site/radicale-htpasswd" = { + "nx2site/radicale/htpasswd" = { owner = "radicale"; }; }; @@ -20,7 +20,7 @@ ]; auth = { type = "htpasswd"; - htpasswd_filename = config.sops.secrets."nx2site/radicale-htpasswd".path; + htpasswd_filename = config.sops.secrets."nx2site/radicale/htpasswd".path; htpasswd_encryption = "bcrypt"; }; }; From c15bf8c58eafb09e9bd818d67792d4557f4e9998 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 13:43:16 +0100 Subject: [PATCH 6/7] little formatting --- system-modules/calendar-dicos.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/system-modules/calendar-dicos.nix b/system-modules/calendar-dicos.nix index e34c8da..ac91913 100644 --- a/system-modules/calendar-dicos.nix +++ b/system-modules/calendar-dicos.nix @@ -13,11 +13,11 @@ systemd.services."nx_cal_dicos" = { script = let nx_cal_dicos = (pkgs.writers.writePython3Bin "nx_cal_dicos" { - libraries = with pkgs.python3Packages; [ - ics - ]; - flakeIgnore = [ "E302" "E305" "E226" "E501" ]; - } /*python */ '' + libraries = with pkgs.python3Packages; [ + ics + ]; + flakeIgnore = [ "E302" "E305" "E226" "E501" ]; + } /* python */ '' import os from glob import glob from ics import Calendar From 6b4a76dd4a2c9433624493668fe59ae012be3f84 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Sat, 22 Feb 2025 13:43:35 +0100 Subject: [PATCH 7/7] fix and refactor dynamic-dns --- system-modules/nx2site.nix | 245 ++++++++++--------------------------- 1 file changed, 66 insertions(+), 179 deletions(-) diff --git a/system-modules/nx2site.nix b/system-modules/nx2site.nix index b8526f3..193b5f1 100644 --- a/system-modules/nx2site.nix +++ b/system-modules/nx2site.nix @@ -29,191 +29,78 @@ let dns-user = "cloudflare"; in Unit = "dynamic-dns.service"; }; }; - services."dynamic-dns" = let - u = let - account_id = secrets.email.gmail-online.mail; - zone_id = "33fecab36e060f49d492127345ea95a0"; - record_id = { # curl --request GET --url https://api.cloudflare.com/client/v4/zones/33fecab36e060f49d492127345ea95a0/dns_records --header 'Content-Type: application/json' --header 'X-Auth-Email: @gmail.com' --header "X-Auth-Key: " -s | jq - base = "58d3412e8d88889d1a611b3669f0700f"; - base6 = "d1b90e21d2d747dcb30448bd65312927"; - sub = "fc861353142bc05d5dbad1799178e6a1"; - sub6 = "b8082b7afe9e80971fc9f9dda16ec284"; - ssh = "c0f14f17f32d6595c202f041dd836eb3"; - ssh6 = "f1ecb2d9d0522d4eec06437688ca76da"; - }; - passord-file-path = config.sops.secrets."nx2site/cloudflare/global-api-key".path; - log-file-path = "/var/log/couldflare.log"; - count-file-path = "/var/log/cloudflare-count.txt"; - in pkgs.writers.writePython3Bin "dyn_dns" { - libraries = with pkgs.python311Packages; [ requests ]; - flakeIgnore = [ "E501" "E305" "E701" "E704" "E302" "E114" "F841" "E121" "E261" "E303" ]; - } /* python */ '' - import requests - import subprocess - # from datetime import datetime + services."dynamic-dns" = { + script = let + dyn-dns = let + account_id = secrets.email.gmail-online.mail; + zone_id = "33fecab36e060f49d492127345ea95a0"; + record_id = { # curl --request GET --url https://api.cloudflare.com/client/v4/zones/33fecab36e060f49d492127345ea95a0/dns_records --header 'Content-Type: application/json' --header 'X-Auth-Email: @gmail.com' --header "X-Auth-Key: " -s | jq + base = "58d3412e8d88889d1a611b3669f0700f"; + base6 = "d1b90e21d2d747dcb30448bd65312927"; + sub = "fc861353142bc05d5dbad1799178e6a1"; + sub6 = "b8082b7afe9e80971fc9f9dda16ec284"; + ssh = "c0f14f17f32d6595c202f041dd836eb3"; + ssh6 = "f1ecb2d9d0522d4eec06437688ca76da"; + }; + passord-file-path = config.sops.secrets."nx2site/cloudflare/global-api-key".path; + in pkgs.writers.writePython3Bin "dyn_dns" { + libraries = with pkgs.python3Packages; [ requests ]; + flakeIgnore = [ "E302" "E305" "E226" "E501" "E261" ]; + } /* python */ '' +import requests +import subprocess - def get_public_ip(ipv6=False): - return subprocess.run(['${pkgs.curl}/bin/curl', '-s', '-6' if ipv6 else '-4', 'https://ifconfig.me'], capture_output=True, text=True).stdout.strip() +def get_public_ip(ipv6: bool = False) -> str: + return subprocess.run(['${pkgs.curl}/bin/curl', '-s', '-6' if ipv6 else '-4', 'https://ifconfig.me'], capture_output=True, text=True).stdout.strip() - def main(): - my_ip = get_public_ip() - my_ip6 = get_public_ip(ipv6=True) +def update_record(record_id: str, record_name: str, ip: str, type: str, proxied: bool, pw: str) -> None: + return requests.patch( + f'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/{record_id}', + headers={ + 'Content-Type': 'application/json', + 'X-Auth-Email': '${account_id}', + 'X-Auth-Key': pw + }, + json={ + "comment": "Domain verification record", + "name": record_name, + "proxied": proxied, + "settings": {}, + "tags": [], + "ttl": 1, # automatic + "content": ip, + "type": type + } + ) - # with open("${count-file-path}", "r") as f: - # content = f.read() - # if content == "": count = 0 - # else: count = int(content) - # count += 1 - # with open("${count-file-path}", "w") as f: - # f.write(str(count)) +def main(): + my_ip = get_public_ip() + my_ip6 = get_public_ip(ipv6=True) - # 4 - with open("${passord-file-path}", 'r') as pw_file: - pw = pw_file.read().strip() + with open("${passord-file-path}", 'r') as pw_file: + pw = pw_file.read().strip() - # Perform DNS updates - # https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-update-dns-record - resp_base = requests.patch( - 'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id.base}', - headers={ - 'Content-Type': 'application/json', - 'X-Auth-Email': '${account_id}', - 'X-Auth-Key': pw - }, - json={ - "comment": "Domain verification record", - "name": "${domain}", - "proxied": True, - "settings": {}, - "tags": [], - "ttl": 1, # automatic - "content": my_ip, - "type": "A" - } - ) + # Perform DNS updates + # https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-update-dns-record + r = update_record(record_id="${record_id.base}", record_name="${domain}", ip=my_ip, type="A", proxied=True, pw=pw) + _ = update_record(record_id="${record_id.sub}", record_name="*.${domain}", ip=my_ip, type="A", proxied=True, pw=pw) + _ = update_record(record_id="${record_id.ssh}", record_name="ssh.${domain}", ip=my_ip, type="A", proxied=False, pw=pw) - resp_subd = requests.patch( - 'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id.sub}', - headers={ - 'Content-Type': 'application/json', - 'X-Auth-Email': '${account_id}', - 'X-Auth-Key': pw - }, - json={ - "comment": "Domain verification record", - "name": "*.${domain}", - "proxied": True, - "settings": {}, - "tags": [], - "ttl": 1, # automatic - "content": my_ip, - "type": "A" - } - ) + if r.status_code != 200: + print(r.text) - resp_sshd = requests.patch( - 'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id.ssh}', - headers={ - 'Content-Type': 'application/json', - 'X-Auth-Email': '${account_id}', - 'X-Auth-Key': pw - }, - json={ - "comment": "Domain verification record", - "name": "ssh.${domain}", - "proxied": False, - "settings": {}, - "tags": [], - "ttl": 1, # automatic - "content": my_ip, - "type": "A" - } - ) + r = update_record(record_id="${record_id.base6}", record_name="${domain}", ip=my_ip6, type="AAAA", proxied=True, pw=pw) + _ = update_record(record_id="${record_id.sub6}", record_name="*.${domain}", ip=my_ip6, type="AAAA", proxied=True, pw=pw) + _ = update_record(record_id="${record_id.ssh6}", record_name="ssh.${domain}", ip=my_ip6, type="AAAA", proxied=False, pw=pw) - if resp_base.status_code != 200: - print(resp_base.text) + if r.status_code != 200: + print(r.text) - - # now_str = datetime.now().strftime('%Y/%m/%d-%R') - # log_entry = f"At {now_str} - to {my_ip} - Response {resp_base.status_code}\n" - # print(log_entry, end="") - # with open("${log-file-path}", 'a') as log_file: - # log_file.write(log_entry) - - # Perform DNS updates - # https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-update-dns-record - resp_base = requests.patch( - 'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id.base6}', - headers={ - 'Content-Type': 'application/json', - 'X-Auth-Email': '${account_id}', - 'X-Auth-Key': pw - }, - json={ - "comment": "Domain verification record", - "name": "${domain}", - "proxied": True, - "settings": {}, - "tags": [], - "ttl": 1, # automatic - "content": my_ip6, - "type": "AAAA" - } - ) - - resp_subd = requests.patch( - 'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id.sub6}', - headers={ - 'Content-Type': 'application/json', - 'X-Auth-Email': '${account_id}', - 'X-Auth-Key': pw - }, - json={ - "comment": "Domain verification record", - "name": "*.${domain}", - "proxied": True, - "settings": {}, - "tags": [], - "ttl": 1, # automatic - "content": my_ip6, - "type": "AAAA" - } - ) - - resp_sshd = requests.patch( - 'https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records/${record_id.ssh6}', - headers={ - 'Content-Type': 'application/json', - 'X-Auth-Email': '${account_id}', - 'X-Auth-Key': pw - }, - json={ - "comment": "Domain verification record", - "name": "ssh.${domain}", - "proxied": False, - "settings": {}, - "tags": [], - "ttl": 1, # automatic - "content": my_ip6, - "type": "AAAA" - } - ) - - if resp_base.status_code != 200: - print(resp_base.text) - - # now_str = datetime.now().strftime('%Y/%m/%d-%R') - # log_entry = f"At {now_str} - to {my_ip6} - Response {resp_base.status_code}\n" - # print(log_entry, end="") - # with open("${log-file-path}", 'a') as log_file: log_file.write(log_entry) - - if __name__ == "__main__": - main() - ''; - in { - script = '' - set -eu - ${u}/bin/dyn_dns +if __name__ == "__main__": + main() + ''; in /* bash */ '' + set -e + ${dyn-dns}/bin/dyn_dns ''; serviceConfig = { Type = "oneshot"; @@ -221,19 +108,19 @@ let dns-user = "cloudflare"; in }; }; }; - networking.hosts = { # docker network inspect nx2site_default | grep -E "Name|IPv4" | tr "\n" " " | sed -r 's- +- -g;s-\n?"Name": -\n-g' | sed -r '1d;2d;s-"(.+?)", "IPv4Address": "(.+)/16",- "\2" = [ "\1.docker" ];-g' + # networking.hosts = { # docker network inspect nx2site_default | grep -E "Name|IPv4" | tr "\n" " " | sed -r 's- +- -g;s-\n?"Name": -\n-g' | sed -r '1d;2d;s-"(.+?)", "IPv4Address": "(.+)/16",- "\2" = [ "\1.docker" ];-g' # "172.1.2.1" = [ "staticweb.docker" ]; # "172.1.3.1" = [ "matrix.docker" ]; # "172.1.0.9" = [ "matrixdb.docker" ]; # "172.1.4.1" = [ "matrix-ss.docker" ]; # "172.1.0.7" = [ "matrix-ssdb.docker" ]; # "172.1.5.1" = [ "pw.docker" ]; - "172.1.6.1" = [ "git.docker" ]; + # "172.1.6.1" = [ "git.docker" ]; # "172.1.0.10" = [ "gitdb.docker" ]; # "172.1.7.1" = [ "nn.docker" ]; # "172.1.8.1" = [ "llm.docker" ]; # "172.1.9.1" = [ "proxy.docker" ]; # "172.1.10.1" = [ "share.docker" ]; # "172.1.11.1" = [ "odq.docker" ]; - }; + # }; }