5 Commits df614de0a5 ... 87372529ae

Author SHA1 Message Date
  Oleg Pykhalov 87372529ae apps: base: workstation: nixos: Mount /home/oleg/.config/wayvnc directory. 2 weeks ago
  Oleg Pykhalov 92ccb69e40 apps: cluster1: workstation: nixos: Update to 096ce36c. 2 weeks ago
  Oleg Pykhalov 513876b793 flake.lock: Update dotfiles-home-manager. 2 weeks ago
  Oleg Pykhalov b0cc5d3340 pc0: home-manager: Add wayvnc. 2 weeks ago
  Oleg Pykhalov b698d74b19 run: pc0: Add macvlan to nixos for vnc. 2 weeks ago

+ 6 - 0
apps/base/workstation/pod.yaml

@@ -211,6 +211,8 @@ spec:
       mountPath: /home/oleg/.config/google-chrome
     - name: root-bash-history
       mountPath: /root/.bash_history
+    - name: home-oleg-config-wayvnc
+      mountPath: /home/oleg/.config/wayvnc
   - image: harbor.home.wugi.info/library/archlinux-systemd:latest
     name: archlinux
     env:
@@ -377,3 +379,7 @@ spec:
     hostPath:
       path: /home/oleg/.config/SocialStream
       type: Directory
+  - name: home-oleg-config-wayvnc
+    hostPath:
+      path: /home/oleg/.config/wayvnc
+      type: Directory

+ 1 - 1
apps/cluster1/workstation/kustomization.yaml

@@ -9,6 +9,6 @@ images:
 - name: harbor.home.wugi.info/library/guix-image-workstation
   newTag: "6677e699"
 - name: harbor.home.wugi.info/library/nixos-systemd
-  newTag: 2072d060
+  newTag: 096ce36c
 - name: harbor.home.wugi.info/library/archlinux-systemd
   newTag: 7a1dcb6c

+ 4 - 4
dotfiles/nix/container-systemd/flake.lock

@@ -268,11 +268,11 @@
       },
       "locked": {
         "dir": "dotfiles/nix",
-        "lastModified": 1730144252,
-        "narHash": "sha256-SW+sXYYx8zFAQKtyt4QHzcNl/94DTtojLjNLty9YasU=",
+        "lastModified": 1730969505,
+        "narHash": "sha256-SA93MeHv9mAKUjepn4Dx+1wmnbqNmwwJ+nwfbUCN2Ag=",
         "ref": "refs/heads/master",
-        "rev": "432b65e10e93c4b57b2c24ba1cdbfb01e0825238",
-        "revCount": 11928,
+        "rev": "0e5a3a91a88372093182a60c711889fa92f2a025",
+        "revCount": 11963,
         "type": "git",
         "url": "file:///home/oleg/.local/share/chezmoi?dir=dotfiles/nix"
       },

+ 2 - 0
dotfiles/nix/pc0/home-manager.nix

@@ -20,6 +20,8 @@
     chatterino2
 
     tmux
+
+    wayvnc
   ];
 
   home.file = {

+ 11 - 0
dotfiles/run/pc0/10-net-nixos.sh

@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+set -o nounset -o errexit -o pipefail -o xtrace
+
+NAMESPACE="$(/home/oleg/.local/share/chezmoi/dotfiles/run/pc0/11-nerdctl-namespace.sh)"
+
+ip link add macvlan3 link eth0 type macvlan mode bridge
+ip link set macvlan3 netns "$NAMESPACE"
+ip netns exec "$NAMESPACE" ip link set macvlan3 up
+ip netns exec "$NAMESPACE" ip addr add 192.168.0.195/24 dev macvlan3
+ip netns exec "$NAMESPACE" ping -c 3 192.168.0.145

+ 19 - 0
dotfiles/run/pc0/11-nerdctl-namespace.sh

@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -o nounset -o errexit -o pipefail
+
+PATH="/home/oleg/.guix-profile/bin:/gnu/store/3q2x34wg1fff833wwzxnagnv7vbfxb0w-jc-1.25.2/bin:$PATH"
+export PATH
+
+container_id="$(nerdctl -n k8s.io ps --format=json | jq --raw-output '. | select (.Image | startswith("harbor.home.wugi.info/library/nixos-systemd")) | .ID')"
+process_id="$(nerdctl -n k8s.io top "$container_id" | jc --ps | jq --raw-output '.[0].pid')"
+ip_address="$(nsenter -t "$process_id" -n ip -json a | jq --raw-output '.[] | select(.ifname == "eth0") | .addr_info[] | select(.family == "inet") | .local')"
+mapfile -t network_namespaces < <(ip -json -all netns | jq --raw-output '.[].name')
+for network_namespace in "${network_namespaces[@]}"
+do
+    if [[ $ip_address == $(ip netns exec "$network_namespace" ip -json a | jq --raw-output '.[] | select(.ifname == "eth0") | .addr_info[] | select(.family == "inet") | .local') ]]
+    then
+        echo "$network_namespace"
+        exit 0
+    fi
+done