better openwrt sub lan control
This commit is contained in:
1 parent
07d5bffef2
commit
e3866d75a9
15 files changed
+384
-573
No files matched your search
+9
-2
@@ -295,9 +295,16 @@ Report written to ($report_file)"
|
||||
}
|
||||
|
||||
# Deploy OpenWrt router configuration
|
||||
export def "skyg openwrt" [router: string = "glmain"] {
|
||||
export def "skyg openwrt" [
|
||||
router: string = "glmain",
|
||||
--dry-run # Render configs to .tmp/openwrt-<router>/ without touching the router
|
||||
] {
|
||||
cd $REPO_ROOT
|
||||
bash -c $"age -d -i ~/.ssh/id_ed25519 secrets/($router).json.age | nix run .#openwrt-($router)"
|
||||
if $dry_run {
|
||||
bash -c $"export SKYG_ROUTER=($router); age -d -i ~/.ssh/id_ed25519 secrets/($router).json.age | nix run .#openwrt-($router)-dry-run"
|
||||
} else {
|
||||
bash -c $"age -d -i ~/.ssh/id_ed25519 secrets/($router).json.age | nix run .#openwrt-($router)"
|
||||
}
|
||||
}
|
||||
|
||||
# Build ISO image
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# =========================
|
||||
# xdg-desktop-portal-hyprland (fwbook)
|
||||
# =========================
|
||||
# Read by xdph itself from ~/.config/hypr/xdph.conf (hyprlang format, not Lua),
|
||||
# so it is not require()'d from hyprland.lua. This directory is symlinked to
|
||||
# ~/.config/hypr by the skyg hyprland module.
|
||||
#
|
||||
# force_shm: skip DMA-BUF buffer negotiation for screencast. xdph fails modifier
|
||||
# fixation on this machine ("DMA-BUF fixation failed after 2 attempts") and tears
|
||||
# the stream down; Chromium then reopens a ScreenCast session, which re-shows the
|
||||
# output picker. Capture already ended up on SHM via the fallback path anyway, so
|
||||
# image quality is unchanged -- this just avoids the failing negotiation and the
|
||||
# teardown it causes.
|
||||
#
|
||||
# Deliberately NOT setting screencopy:allow_token_by_default -- it would auto-grant
|
||||
# restore tokens to any app that asks, letting it silently re-capture later. Tick
|
||||
# "allow restore token" in the picker instead.
|
||||
|
||||
screencopy {
|
||||
force_shm = true
|
||||
}
|
||||
Generated
+37
-540
@@ -24,22 +24,18 @@
|
||||
"aquamarine": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -59,39 +55,6 @@
|
||||
}
|
||||
},
|
||||
"aquamarine_2": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprland",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787400831,
|
||||
"narHash": "sha256-H3MEkFDZf+UH+QrVgW8TdKrssPFltF8fBg/rh0J1zIc=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "aquamarine",
|
||||
"rev": "7ce889cb78b97979b83a4648509fc3ef405c3286",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "aquamarine",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"aquamarine_3": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprlauncher",
|
||||
@@ -447,22 +410,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_6": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
@@ -732,17 +679,14 @@
|
||||
"hyprcursor": {
|
||||
"inputs": {
|
||||
"hyprlang": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprlang"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -761,49 +705,17 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprcursor_2": {
|
||||
"inputs": {
|
||||
"hyprlang": [
|
||||
"hyprland",
|
||||
"hyprlang"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786464181,
|
||||
"narHash": "sha256-2alOMkLjXANh7unkZnYnCF2K2rApZaOLMoQ3o+VX2CY=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprcursor",
|
||||
"rev": "e4ed7c08123df5af460a0a70961380cbfb872f76",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprcursor",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprgraphics": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -823,35 +735,6 @@
|
||||
}
|
||||
},
|
||||
"hyprgraphics_2": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786464367,
|
||||
"narHash": "sha256-k58p4wbzIXWyRWrW84pP8tD+iaZSSYiiM+fr0Auk4oU=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprgraphics",
|
||||
"rev": "7c895c44e3ca6d28ed68ddd80ec02b02b925e7fc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprgraphics",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprgraphics_3": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprlauncher",
|
||||
@@ -882,7 +765,9 @@
|
||||
},
|
||||
"hyprgrass": {
|
||||
"inputs": {
|
||||
"hyprland": "hyprland",
|
||||
"hyprland": [
|
||||
"hyprland"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
@@ -936,38 +821,31 @@
|
||||
"hyprland-guiutils": {
|
||||
"inputs": {
|
||||
"aquamarine": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"aquamarine"
|
||||
],
|
||||
"hyprgraphics": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprgraphics"
|
||||
],
|
||||
"hyprlang": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprtoolkit": "hyprtoolkit",
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -986,80 +864,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprland-guiutils_2": {
|
||||
"inputs": {
|
||||
"aquamarine": [
|
||||
"hyprland",
|
||||
"aquamarine"
|
||||
],
|
||||
"hyprgraphics": [
|
||||
"hyprland",
|
||||
"hyprgraphics"
|
||||
],
|
||||
"hyprlang": [
|
||||
"hyprland",
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprtoolkit": "hyprtoolkit_2",
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprland",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786464504,
|
||||
"narHash": "sha256-7sHwM86KILQyHDHDuE2SDBlQ2jvZ0EW3hY7sW009/cg=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-guiutils",
|
||||
"rev": "4c30cf3097ea963c0e250749ee0c59f8b08816d6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-guiutils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprland-protocols": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772460177,
|
||||
"narHash": "sha256-/6G/MsPvtn7bc4Y32pserBT/Z4SUUdBd4XYJpOEKVR4=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-protocols",
|
||||
"rev": "1cb6db5fd6bb8aee419f4457402fa18293ace917",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-protocols",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprland-protocols_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
@@ -1084,50 +889,17 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprland_2": {
|
||||
"inputs": {
|
||||
"aquamarine": "aquamarine_2",
|
||||
"hyprcursor": "hyprcursor_2",
|
||||
"hyprgraphics": "hyprgraphics_2",
|
||||
"hyprland-guiutils": "hyprland-guiutils_2",
|
||||
"hyprland-protocols": "hyprland-protocols_2",
|
||||
"hyprlang": "hyprlang_2",
|
||||
"hyprutils": "hyprutils_2",
|
||||
"hyprwayland-scanner": "hyprwayland-scanner_2",
|
||||
"hyprwire": "hyprwire_2",
|
||||
"nixpkgs": "nixpkgs_7",
|
||||
"pre-commit-hooks": "pre-commit-hooks_3",
|
||||
"systems": "systems_4",
|
||||
"xdph": "xdph_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1787612295,
|
||||
"narHash": "sha256-K7sUeS1tKTSDu+aQK0ZwCxJCls+JzDj1qeTJRGk+CV8=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"rev": "0bd11c7a04a63d2785abd53363f09d552175d67d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "Hyprland",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprlang": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -1149,15 +921,15 @@
|
||||
"hyprlang_2": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprlauncher",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"hyprlauncher",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"hyprlauncher",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
@@ -1176,35 +948,6 @@
|
||||
}
|
||||
},
|
||||
"hyprlang_3": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprlauncher",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprlauncher",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprlauncher",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786464129,
|
||||
"narHash": "sha256-339AkTlpMYSIvFuG0rnR+8Yg4/AZKeJalshJavlnKfg=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprlang",
|
||||
"rev": "9508458be316a0d70d37ebed1ab725ccd10411ff",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprlang",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprlang_4": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprlauncher",
|
||||
@@ -1238,15 +981,15 @@
|
||||
},
|
||||
"hyprlauncher": {
|
||||
"inputs": {
|
||||
"aquamarine": "aquamarine_3",
|
||||
"hyprgraphics": "hyprgraphics_3",
|
||||
"hyprlang": "hyprlang_3",
|
||||
"hyprtoolkit": "hyprtoolkit_3",
|
||||
"hyprutils": "hyprutils_3",
|
||||
"hyprwayland-scanner": "hyprwayland-scanner_3",
|
||||
"hyprwire": "hyprwire_3",
|
||||
"nixpkgs": "nixpkgs_8",
|
||||
"systems": "systems_5"
|
||||
"aquamarine": "aquamarine_2",
|
||||
"hyprgraphics": "hyprgraphics_2",
|
||||
"hyprlang": "hyprlang_2",
|
||||
"hyprtoolkit": "hyprtoolkit_2",
|
||||
"hyprutils": "hyprutils_2",
|
||||
"hyprwayland-scanner": "hyprwayland-scanner_2",
|
||||
"hyprwire": "hyprwire_2",
|
||||
"nixpkgs": "nixpkgs_7",
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786644260,
|
||||
@@ -1265,43 +1008,36 @@
|
||||
"hyprtoolkit": {
|
||||
"inputs": {
|
||||
"aquamarine": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"aquamarine"
|
||||
],
|
||||
"hyprgraphics": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprgraphics"
|
||||
],
|
||||
"hyprlang": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"systems"
|
||||
@@ -1322,58 +1058,6 @@
|
||||
}
|
||||
},
|
||||
"hyprtoolkit_2": {
|
||||
"inputs": {
|
||||
"aquamarine": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"aquamarine"
|
||||
],
|
||||
"hyprgraphics": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprgraphics"
|
||||
],
|
||||
"hyprlang": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"hyprland-guiutils",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1785930473,
|
||||
"narHash": "sha256-DitTu625BhEYpZjtjxtGpjrEJwPwW+X/+jJvhSZNSJM=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprtoolkit",
|
||||
"rev": "af515b69dfbe366dc7873aa1475cb2f4db3ebad7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprtoolkit",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprtoolkit_3": {
|
||||
"inputs": {
|
||||
"aquamarine": [
|
||||
"hyprlauncher",
|
||||
@@ -1383,7 +1067,7 @@
|
||||
"hyprlauncher",
|
||||
"hyprgraphics"
|
||||
],
|
||||
"hyprlang": "hyprlang_4",
|
||||
"hyprlang": "hyprlang_3",
|
||||
"hyprutils": [
|
||||
"hyprlauncher",
|
||||
"hyprutils"
|
||||
@@ -1418,12 +1102,10 @@
|
||||
"hyprutils": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -1443,31 +1125,6 @@
|
||||
}
|
||||
},
|
||||
"hyprutils_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786903207,
|
||||
"narHash": "sha256-QTwMqLLONRhv9iz6CVeuX6BqQNQCIqI8hL/cPYlR/24=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprutils",
|
||||
"rev": "6cf50415e06dc6bd9f1252f1b745eac6b4a1cc39",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprutils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprutils_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprlauncher",
|
||||
@@ -1495,12 +1152,10 @@
|
||||
"hyprwayland-scanner": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -1520,31 +1175,6 @@
|
||||
}
|
||||
},
|
||||
"hyprwayland-scanner_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786464033,
|
||||
"narHash": "sha256-QM8Qe4/L8lpdVN4bgwahmi+jyyc4fisseDMe4afcDxA=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprwayland-scanner",
|
||||
"rev": "62e62c1ca23da17612c6890d4ad2064f575643db",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprwayland-scanner",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprwayland-scanner_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"hyprlauncher",
|
||||
@@ -1572,17 +1202,14 @@
|
||||
"hyprwire": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -1602,35 +1229,6 @@
|
||||
}
|
||||
},
|
||||
"hyprwire_2": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786464294,
|
||||
"narHash": "sha256-ZQsZ2WvBdkboCIyh8LStDPdAIARmxzn0XMNxxoOhjPE=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprwire",
|
||||
"rev": "4ce7cd6b6128c1ac41caf23c58a30a26b327f9dd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprwire",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprwire_3": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprlauncher",
|
||||
@@ -1738,7 +1336,7 @@
|
||||
},
|
||||
"nixos-hardware": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_9"
|
||||
"nixpkgs": "nixpkgs_8"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786867632,
|
||||
@@ -1817,20 +1415,6 @@
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1"
|
||||
}
|
||||
},
|
||||
"nixpkgs_10": {
|
||||
"locked": {
|
||||
"lastModified": 1786711500,
|
||||
"narHash": "sha256-QvnceIGTBeDvDd9oCn+GvdsnkquliuwbVgpiRH68qaQ=",
|
||||
"rev": "02e08985a27c65ffd33d434eeb2e660a2e4dc84d",
|
||||
"revCount": 1011966,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2605.1011966%2Brev-02e08985a27c65ffd33d434eeb2e660a2e4dc84d/01a003f1-59bd-7782-b0ed-5cbf8697f61e/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1784160687,
|
||||
@@ -1908,22 +1492,6 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs_7": {
|
||||
"locked": {
|
||||
"lastModified": 1787360063,
|
||||
"narHash": "sha256-dt4WdcvsA8/RCe+VZZwqU0X+XMM3wBbGCWA0/sFWzGo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2c423e03bbafcff28bfadc6781a4a8257f205cb5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_8": {
|
||||
"locked": {
|
||||
"lastModified": 1786247143,
|
||||
"narHash": "sha256-8S3Kcxs7D4UtxJxSJZz0m14CGhuW0MxfrIwJxeGWGnQ=",
|
||||
@@ -1939,7 +1507,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_9": {
|
||||
"nixpkgs_8": {
|
||||
"locked": {
|
||||
"lastModified": 1767892417,
|
||||
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
|
||||
@@ -1952,6 +1520,20 @@
|
||||
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"nixpkgs_9": {
|
||||
"locked": {
|
||||
"lastModified": 1786711500,
|
||||
"narHash": "sha256-QvnceIGTBeDvDd9oCn+GvdsnkquliuwbVgpiRH68qaQ=",
|
||||
"rev": "02e08985a27c65ffd33d434eeb2e660a2e4dc84d",
|
||||
"revCount": 1011966,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2605.1011966%2Brev-02e08985a27c65ffd33d434eeb2e660a2e4dc84d/01a003f1-59bd-7782-b0ed-5cbf8697f61e/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/0"
|
||||
}
|
||||
},
|
||||
"noctalia": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -2044,29 +1626,6 @@
|
||||
"pre-commit-hooks_2": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_5",
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1784288435,
|
||||
"narHash": "sha256-ReRHaLgr/uVqdD8afFSn+myXIfpHeOhP0yYe0TJqAA8=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "43b3c1ab9d40fb1dbb008f451988a91e375825e9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks_3": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_6",
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
@@ -2147,17 +1706,17 @@
|
||||
"hermes-agent": "hermes-agent",
|
||||
"home-manager": "home-manager_2",
|
||||
"hyprgrass": "hyprgrass",
|
||||
"hyprland": "hyprland_2",
|
||||
"hyprland": "hyprland",
|
||||
"hyprlauncher": "hyprlauncher",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-flatpak": "nix-flatpak",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_10",
|
||||
"nixpkgs": "nixpkgs_9",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"noctalia": "noctalia",
|
||||
"stylix": "stylix",
|
||||
"systems": "systems_7"
|
||||
"systems": "systems_6"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
@@ -2190,7 +1749,7 @@
|
||||
"nixpkgs"
|
||||
],
|
||||
"nur": "nur",
|
||||
"systems": "systems_6",
|
||||
"systems": "systems_5",
|
||||
"tinted-kitty": "tinted-kitty",
|
||||
"tinted-schemes": "tinted-schemes",
|
||||
"tinted-tmux": "tinted-tmux",
|
||||
@@ -2272,21 +1831,6 @@
|
||||
}
|
||||
},
|
||||
"systems_5": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_6": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
@@ -2301,7 +1845,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_7": {
|
||||
"systems_6": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
@@ -2408,32 +1952,26 @@
|
||||
"xdph": {
|
||||
"inputs": {
|
||||
"hyprland-protocols": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprland-protocols"
|
||||
],
|
||||
"hyprlang": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprutils": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprgrass",
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
@@ -2451,47 +1989,6 @@
|
||||
"repo": "xdg-desktop-portal-hyprland",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"xdph_2": {
|
||||
"inputs": {
|
||||
"hyprland-protocols": [
|
||||
"hyprland",
|
||||
"hyprland-protocols"
|
||||
],
|
||||
"hyprlang": [
|
||||
"hyprland",
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprutils": [
|
||||
"hyprland",
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprland",
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"hyprland",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"hyprland",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786988229,
|
||||
"narHash": "sha256-frEFLVRj8xXvBBDs44IRiqHo6R2PxsRpluygL7abjjI=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "xdg-desktop-portal-hyprland",
|
||||
"rev": "59d429bf45aed4e2209043c0c36565ad8e2859a5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "xdg-desktop-portal-hyprland",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -52,7 +52,10 @@
|
||||
# Hyprland compositor via flake (latest git).
|
||||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
# Hyprland touchpad gesture plugin
|
||||
hyprgrass.url = "github:horriblename/hyprgrass";
|
||||
hyprgrass = {
|
||||
url = "github:horriblename/hyprgrass";
|
||||
inputs.hyprland.follows = "hyprland";
|
||||
};
|
||||
# Secrets management
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
# Claude Desktop
|
||||
@@ -191,6 +194,7 @@
|
||||
in
|
||||
{
|
||||
openwrt-glmain = (openwrt (import ./openwrt-routers/glmain.nix)).deployScript;
|
||||
openwrt-glmain-dry-run = (openwrt (import ./openwrt-routers/glmain.nix)).dryRunScript;
|
||||
grok-cli = lib.pkgs.${system}.grok-cli;
|
||||
# CPU variant of DwarfStar (antirez/ds4); buildable on any system.
|
||||
# GPU variants (ds4-rocm/ds4-cuda) are overlay-only — see modules/core.
|
||||
|
||||
@@ -16,17 +16,39 @@ openwrt/
|
||||
## How it works
|
||||
|
||||
1. The router config lives as an **agenix secret** (e.g. `secrets/glmain.json.age`).
|
||||
2. `openwrt-deploy` reads the decrypted JSON from stdin, runs `openwrt-gen dnsmasq` and
|
||||
`openwrt-gen ethers` to render the two target files.
|
||||
3. It SSHes to the router, shows a **colorized diff** against the current files, and prompts
|
||||
for confirmation before writing.
|
||||
4. `dnsmasq.conf` is validated with `dnsmasq --test` on the router and **automatically
|
||||
reverted** if the new config is invalid.
|
||||
2. `openwrt-deploy` reads the decrypted JSON from stdin, runs `openwrt-gen dnsmasq`,
|
||||
`openwrt-gen ethers`, and `openwrt-gen firewall` to render the three target files.
|
||||
3. It SSHes to the router, shows a **colorized diff** against the current files (for the
|
||||
firewall, only the `skyg_*`-managed rules are diffed), and prompts for confirmation.
|
||||
4. On the router it **backs up** the configs it overrides to `/etc/skyg-backups/` with a
|
||||
timestamp, then applies them. `dnsmasq.conf` is validated with `dnsmasq --test` and the
|
||||
firewall is committed + reloaded; **any failure auto-restores** from that timestamp's
|
||||
backups. Backups persist so you can restore later if something breaks:
|
||||
```sh
|
||||
cp /etc/skyg-backups/firewall.<ts> /etc/config/firewall
|
||||
uci commit firewall && /etc/init.d/firewall restart
|
||||
```
|
||||
|
||||
```
|
||||
age -d secrets/glmain.json.age | openwrt-deploy
|
||||
```
|
||||
|
||||
### Dry run (no router changes)
|
||||
|
||||
`openwrt-dry-run` renders the same three configs **locally** and writes them to
|
||||
`.tmp/openwrt-<router>/` for review — no SSH, no `uci`, no confirm prompt. The router name
|
||||
comes from the `SKYG_ROUTER` env var (default `glmain`).
|
||||
|
||||
```bash
|
||||
skyg openwrt --dry-run
|
||||
# → .tmp/openwrt-glmain/dnsmasq.conf
|
||||
# → .tmp/openwrt-glmain/ethers
|
||||
# → .tmp/openwrt-glmain/firewall.batch # the exact `uci batch` that would be applied
|
||||
```
|
||||
|
||||
Use this to inspect what a deploy *would* do (especially the firewall rules) before running
|
||||
the real `skyg openwrt`.
|
||||
|
||||
`router.ip` / `router.user` are taken from the `config` passed into `default.nix`.
|
||||
|
||||
## Conventions
|
||||
@@ -35,3 +57,6 @@ age -d secrets/glmain.json.age | openwrt-deploy
|
||||
- Deploys are interactive and reviewed by a human; the script intentionally requires
|
||||
confirmation and self-reverts on a bad dnsmasq config.
|
||||
- `generator/target/` is gitignored Rust build output — ignore it.
|
||||
- Firewall rules are **managed by name**: the deploy script only touches rules named
|
||||
`skyg_*`. It deletes existing `skyg_*` rules, adds the newly generated ones, commits, and
|
||||
reloads — so deploys are idempotent and never clobber hand-written rules.
|
||||
+91
-17
@@ -7,6 +7,54 @@ let
|
||||
src = ./generator;
|
||||
cargoLock.lockFile = ./generator/Cargo.lock;
|
||||
};
|
||||
|
||||
# Remote apply script: backs up the configs it overrides, applies the new
|
||||
# firewall/dnsmasq/ethers, validates, and auto-restores on failure.
|
||||
# Run on the router as: TS=<timestamp> bash skyg-apply.sh
|
||||
# Expects the new files staged at /tmp/skyg_firewall.batch,
|
||||
# /tmp/dnsmasq.new.conf and /tmp/ethers.new.
|
||||
applyScript = pkgs.writeText {
|
||||
name = "skyg-apply.sh";
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
BK=/etc/skyg-backups
|
||||
mkdir -p "$BK"
|
||||
cp /etc/config/firewall "$BK/firewall.$TS"
|
||||
cp /etc/dnsmasq.conf "$BK/dnsmasq.conf.$TS"
|
||||
cp /etc/ethers "$BK/ethers.$TS" 2>/dev/null || true
|
||||
|
||||
# --- Firewall: replace the skyg-managed rules ---
|
||||
for ref in $(uci show firewall | awk -F. '/\.name=.skyg_/{print $1"."$2}'); do
|
||||
uci -q del "$ref" || true
|
||||
done
|
||||
if ! uci batch < /tmp/skyg_firewall.batch; then
|
||||
echo 'FIREWALL: uci batch failed, restoring'
|
||||
cp "$BK/firewall.$TS" /etc/config/firewall
|
||||
exit 1
|
||||
fi
|
||||
if ! uci commit firewall; then
|
||||
echo 'FIREWALL: uci commit failed, restoring'
|
||||
cp "$BK/firewall.$TS" /etc/config/firewall
|
||||
exit 1
|
||||
fi
|
||||
/etc/init.d/firewall reload
|
||||
|
||||
# --- dnsmasq ---
|
||||
cp /tmp/dnsmasq.new.conf /etc/dnsmasq.conf
|
||||
if dnsmasq --test; then
|
||||
/etc/init.d/dnsmasq restart
|
||||
else
|
||||
echo 'dnsmasq config invalid, restoring'
|
||||
cp "$BK/dnsmasq.conf.$TS" /etc/dnsmasq.conf
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- ethers ---
|
||||
cp /tmp/ethers.new /etc/ethers
|
||||
|
||||
echo 'Done'
|
||||
'';
|
||||
};
|
||||
in
|
||||
config:
|
||||
|
||||
@@ -23,10 +71,16 @@ let
|
||||
|
||||
DNSMASQ=$(echo "$CONFIG" | ${generator}/bin/openwrt-gen dnsmasq)
|
||||
ETHERS=$(echo "$CONFIG" | ${generator}/bin/openwrt-gen ethers)
|
||||
FIREWALL=$(echo "$CONFIG" | ${generator}/bin/openwrt-gen firewall)
|
||||
|
||||
echo "Fetching current config from $SERVER..."
|
||||
CURRENT_DNSMASQ=$(ssh "$SERVER" 'cat /etc/dnsmasq.conf' 2>/dev/null || echo "")
|
||||
CURRENT_ETHERS=$(ssh "$SERVER" 'cat /etc/ethers' 2>/dev/null || echo "")
|
||||
CURRENT_FIREWALL_ALL=$(ssh "$SERVER" 'uci export firewall' 2>/dev/null || echo "")
|
||||
# Keep only the skyg-managed rule blocks (for the diff)
|
||||
CURRENT_FIREWALL=$(echo "$CURRENT_FIREWALL_ALL" | awk '/^config /{if(have && block ~ /skyg_/) print block; block=$0; have=1; next}{if(have) block=block ORS $0}END{if(have && block ~ /skyg_/) print block}')
|
||||
# Drop the header comment from the generated firewall for a clean diff
|
||||
NEW_FIREWALL=$(echo "$FIREWALL" | tail -n +2)
|
||||
|
||||
echo ""
|
||||
echo "$DNSMASQ"
|
||||
@@ -34,8 +88,6 @@ let
|
||||
comm -3 <(echo "$CURRENT_DNSMASQ" | sort) <(echo "$DNSMASQ" | sort) | awk '{if ($0 ~ /^</) print "\033[31m"$0"\033[0m"; else if ($0 ~ /^>/) print "\033[32m"$0"\033[0m"; else print}'
|
||||
echo "=== dnsmasq.conf diff [END] ==="
|
||||
echo ""
|
||||
read -p "Looks good? [y/N] " -n 1 -r < /dev/tty; echo
|
||||
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
|
||||
|
||||
echo "$ETHERS"
|
||||
echo "=== ethers diff [START] ==="
|
||||
@@ -43,26 +95,48 @@ let
|
||||
echo "=== ethers diff [END] ==="
|
||||
echo ""
|
||||
|
||||
echo "$NEW_FIREWALL"
|
||||
echo "=== firewall (skyg rules) diff [START] ==="
|
||||
comm -3 <(echo "$CURRENT_FIREWALL" | sort) <(echo "$NEW_FIREWALL" | sort) | awk '{if ($0 ~ /^</) print "\033[31m"$0"\033[0m"; else if ($0 ~ /^>/) print "\033[32m"$0"\033[0m"; else print}'
|
||||
echo "=== firewall (skyg rules) diff [END] ==="
|
||||
echo ""
|
||||
|
||||
read -p "Deploy to $SERVER? [y/N] " -n 1 -r < /dev/tty; echo
|
||||
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
|
||||
|
||||
echo "$DNSMASQ" | ssh "$SERVER" 'cat > /tmp/dnsmasq.new.conf'
|
||||
echo "$ETHERS" | ssh "$SERVER" 'cat > /etc/ethers'
|
||||
TS=$(date +%Y%m%d-%H%M%S)
|
||||
|
||||
ssh "$SERVER" '
|
||||
cp /etc/dnsmasq.conf /tmp/dnsmasq.old.conf
|
||||
cp /tmp/dnsmasq.new.conf /etc/dnsmasq.conf
|
||||
if dnsmasq --test; then
|
||||
/etc/init.d/dnsmasq restart
|
||||
echo "Done"
|
||||
else
|
||||
echo "Config invalid, reverting..."
|
||||
cp /tmp/dnsmasq.old.conf /etc/dnsmasq.conf
|
||||
exit 1
|
||||
fi
|
||||
'
|
||||
# Stage the apply script and the new config files on the router
|
||||
ssh "$SERVER" 'cat > /tmp/skyg_apply.sh' < "${applyScript}"
|
||||
echo "$DNSMASQ" | ssh "$SERVER" 'cat > /tmp/dnsmasq.new.conf'
|
||||
echo "$ETHERS" | ssh "$SERVER" 'cat > /tmp/ethers.new'
|
||||
echo "$FIREWALL" | ssh "$SERVER" 'cat > /tmp/skyg_firewall.batch'
|
||||
|
||||
# Back up, apply, validate, auto-restore on failure
|
||||
ssh "$SERVER" "TS=$TS bash /tmp/skyg_apply.sh"
|
||||
'';
|
||||
|
||||
# Dry-run: render the configs locally and write them to .tmp/openwrt-<router>/
|
||||
# for review. No SSH, no uci, no router changes. Run from the repo root.
|
||||
# The router name is taken from $SKYG_ROUTER (default glmain).
|
||||
dryRunScript = pkgs.writeShellScriptBin "openwrt-dry-run" ''
|
||||
set -euo pipefail
|
||||
ROUTER="$'{SKYG_ROUTER:-glmain}"
|
||||
OUTDIR=".tmp/openwrt-$ROUTER"
|
||||
mkdir -p "$OUTDIR"
|
||||
|
||||
CONFIG=$(cat)
|
||||
|
||||
echo "$CONFIG" | ${generator}/bin/openwrt-gen dnsmasq > "$OUTDIR/dnsmasq.conf"
|
||||
echo "$CONFIG" | ${generator}/bin/openwrt-gen ethers > "$OUTDIR/ethers"
|
||||
echo "$CONFIG" | ${generator}/bin/openwrt-gen firewall > "$OUTDIR/firewall.batch"
|
||||
|
||||
echo "Dry-run configs written to $OUTDIR (no router changes made):"
|
||||
echo " $OUTDIR/dnsmasq.conf"
|
||||
echo " $OUTDIR/ethers"
|
||||
echo " $OUTDIR/firewall.batch"
|
||||
'';
|
||||
in
|
||||
{
|
||||
inherit deployScript;
|
||||
inherit deployScript dryRunScript;
|
||||
}
|
||||
@@ -15,17 +15,19 @@ generator/
|
||||
│ ├── config.rs # serde Deserialize structs for the input JSON (+ unit tests)
|
||||
│ ├── network.rs # process_network — expands per-network device lists
|
||||
│ └── generators/
|
||||
│ ├── mod.rs # re-exports dnsmasq + ethers
|
||||
│ ├── mod.rs # re-exports dnsmasq + ethers + firewall
|
||||
│ ├── dnsmasq.rs # renders dnsmasq.conf (server= + address= lines)
|
||||
│ └── ethers.rs # renders /etc/ethers (MAC → name/IP)
|
||||
│ ├── ethers.rs # renders /etc/ethers (MAC → name/IP)
|
||||
│ └── firewall.rs # renders UCI firewall rules (internet-only networks)
|
||||
└── target/ # gitignored Cargo build output — ignore it
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
openwrt-gen dnsmasq < config.json # prints dnsmasq.conf
|
||||
openwrt-gen ethers < config.json # prints /etc/ethers
|
||||
openwrt-gen dnsmasq < config.json # prints dnsmasq.conf
|
||||
openwrt-gen ethers < config.json # prints /etc/ethers
|
||||
openwrt-gen firewall < config.json # prints UCI firewall rules (uci batch format)
|
||||
```
|
||||
|
||||
## Input shape (`config.rs`)
|
||||
@@ -33,6 +35,23 @@ openwrt-gen ethers < config.json # prints /etc/ethers
|
||||
- `generalMappings`: `[{ ip, domains[] }]` — shared domain→IP records.
|
||||
- `networks`: `{ <network>: [ { mac, name, id?, domains?, justMac? } ] }` — per-network hosts.
|
||||
- `dnsResolvers`: `[{ ip, port?, name? }]` — upstream `server=` entries for dnsmasq.
|
||||
- `internetOnly`: `[<network>, ...]` — networks restricted to internet-only access.
|
||||
|
||||
## Internet-only firewall rules (`firewall.rs`)
|
||||
|
||||
For each network in `internetOnly`, the generator emits UCI `config rule` blocks that DROP
|
||||
forwarded traffic from that network to the rest of the LAN (`10.0.0.0/16`):
|
||||
|
||||
- **IPv4** — one rule per network matching the whole subnet (catches every device on it).
|
||||
- **IPv6** — one rule per known device MAC. All subnets share a single ULA /64
|
||||
(`fd59:de0a:bff5::/48`, see `network::ULA_PREFIX`), so subnets are not distinguishable
|
||||
in IPv6 and blocking is done per known device. An *unknown* IPv6-only device on those
|
||||
subnets is **not** blocked (inherent to the flat-L2 topology).
|
||||
|
||||
Rules are named `skyg_<network>_drop_lan` (IPv4) and `skyg_<network>_drop_lan_v6` (IPv6) so
|
||||
the deploy script owns exactly these. They are inserted before port-specific ACCEPT rules
|
||||
(e.g. the existing `sambasharelan`) so the DROPs win. Reverse direction (LAN → restricted
|
||||
network) stays open, and within-subnet traffic (e.g. cam→cam) is blocked.
|
||||
|
||||
## Conventions
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ pub struct Config {
|
||||
pub networks: BTreeMap<String, Vec<Device>>,
|
||||
#[serde(default, rename = "dnsResolvers")]
|
||||
pub dns_resolvers: Vec<DnsResolver>,
|
||||
/// Networks whose devices may only reach the internet, not the rest of the LAN.
|
||||
#[serde(default, rename = "internetOnly")]
|
||||
pub internet_only: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -82,4 +85,18 @@ mod tests {
|
||||
assert_eq!(resolver.port, Some(853));
|
||||
assert_eq!(resolver.name, Some("CF".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_internet_only_parsing() {
|
||||
let json = r#"{"generalMappings": [], "networks": {}, "internetOnly": ["cam", "apl", "iot"]}"#;
|
||||
let config: Config = serde_json::from_str(json).unwrap();
|
||||
assert_eq!(config.internet_only, vec!["cam", "apl", "iot"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_internet_only_defaults_empty() {
|
||||
let json = r#"{"generalMappings": [], "networks": {}}"#;
|
||||
let config: Config = serde_json::from_str(json).unwrap();
|
||||
assert!(config.internet_only.is_empty());
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ mod tests {
|
||||
domains,
|
||||
just_mac: false,
|
||||
}]);
|
||||
Config { general_mappings: vec![], networks, dns_resolvers: vec![] }
|
||||
Config { general_mappings: vec![], networks, dns_resolvers: vec![], internet_only: vec![] }
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -80,6 +80,7 @@ mod tests {
|
||||
}],
|
||||
networks: BTreeMap::new(),
|
||||
dns_resolvers: vec![],
|
||||
internet_only: vec![],
|
||||
};
|
||||
let result = generate(&config);
|
||||
assert!(result.contains("address=/gw.local/192.168.1.1\n"));
|
||||
@@ -95,6 +96,7 @@ mod tests {
|
||||
port: Some(853),
|
||||
name: Some("CF".to_string()),
|
||||
}],
|
||||
internet_only: vec![],
|
||||
};
|
||||
let result = generate(&config);
|
||||
assert!(result.contains("server=1.1.1.1#853 # CF\n"));
|
||||
@@ -106,6 +108,7 @@ mod tests {
|
||||
general_mappings: vec![],
|
||||
networks: BTreeMap::new(),
|
||||
dns_resolvers: vec![],
|
||||
internet_only: vec![],
|
||||
};
|
||||
assert!(generate(&config).is_empty());
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ mod tests {
|
||||
domains: None,
|
||||
just_mac,
|
||||
}]);
|
||||
Config { general_mappings: vec![], networks, dns_resolvers: vec![] }
|
||||
Config { general_mappings: vec![], networks, dns_resolvers: vec![], internet_only: vec![] }
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -69,6 +69,7 @@ mod tests {
|
||||
general_mappings: vec![],
|
||||
networks: BTreeMap::new(),
|
||||
dns_resolvers: vec![],
|
||||
internet_only: vec![],
|
||||
};
|
||||
assert!(generate(&config).is_empty());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
use crate::config::Config;
|
||||
use crate::network::{prefix_for, process_network, ULA_PREFIX};
|
||||
|
||||
/// Renders UCI firewall rules (in `uci batch` format) that restrict the networks
|
||||
/// listed in `config.internet_only` to internet-only access.
|
||||
///
|
||||
/// For each restricted network:
|
||||
/// - IPv4: a single DROP rule matching the whole subnet (catches all devices on it).
|
||||
/// - IPv6: a DROP rule per known device MAC (all subnets share one /64, so subnets
|
||||
/// are not distinguishable in IPv6).
|
||||
///
|
||||
/// Rules are named `skyg_<network>_drop_lan[_v6]` so the deploy script can manage
|
||||
/// exactly the rules it owns. They are inserted before port-specific ACCEPT rules
|
||||
/// (e.g. the existing `sambasharelan`) so the DROPs win.
|
||||
pub fn generate(config: &Config) -> String {
|
||||
let mut out = String::new();
|
||||
out.push_str("# Managed by skyg openwrt — do not edit by hand\n");
|
||||
|
||||
for network in &config.internet_only {
|
||||
let devices = match config.networks.get(network) {
|
||||
Some(d) => d,
|
||||
None => continue, // unknown network name; skip
|
||||
};
|
||||
|
||||
// IPv4: block the whole subnet from reaching the rest of the LAN.
|
||||
let v4_prefix = prefix_for(network);
|
||||
let v4_subnet = format!("{}.0/24", v4_prefix.trim_end_matches('.'));
|
||||
out.push_str(&format!(
|
||||
"config rule\n\
|
||||
\toption name 'skyg_{net}_drop_lan'\n\
|
||||
\toption src 'lan'\n\
|
||||
\toption dest 'lan'\n\
|
||||
\toption src_ip '{subnet}'\n\
|
||||
\toption dest_ip '10.0.0.0/16'\n\
|
||||
\toption target 'DROP'\n\
|
||||
\toption family 'ipv4'\n",
|
||||
net = network,
|
||||
subnet = v4_subnet,
|
||||
));
|
||||
|
||||
// IPv6: block each known device's MAC from reaching the ULA LAN.
|
||||
for pd in process_network(network, devices) {
|
||||
out.push_str(&format!(
|
||||
"config rule\n\
|
||||
\toption name 'skyg_{net}_drop_lan_v6'\n\
|
||||
\toption src 'lan'\n\
|
||||
\toption dest 'lan'\n\
|
||||
\toption src_mac '{mac}'\n\
|
||||
\toption dest_ip '{ula}'\n\
|
||||
\toption target 'DROP'\n\
|
||||
\toption family 'ipv6'\n",
|
||||
net = network,
|
||||
mac = pd.device.mac,
|
||||
ula = ULA_PREFIX,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
out
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::config::{Config, Device};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
fn config_with_devices(internet_only: Vec<String>) -> Config {
|
||||
let mut networks = BTreeMap::new();
|
||||
networks.insert(
|
||||
"cam".to_string(),
|
||||
vec![
|
||||
Device {
|
||||
mac: "aa:bb:cc:dd:ee:01".to_string(),
|
||||
name: "doorbell".to_string(),
|
||||
id: None,
|
||||
domains: None,
|
||||
just_mac: false,
|
||||
},
|
||||
Device {
|
||||
mac: "aa:bb:cc:dd:ee:02".to_string(),
|
||||
name: "cam2".to_string(),
|
||||
id: None,
|
||||
domains: None,
|
||||
just_mac: false,
|
||||
},
|
||||
],
|
||||
);
|
||||
Config {
|
||||
general_mappings: vec![],
|
||||
networks,
|
||||
dns_resolvers: vec![],
|
||||
internet_only,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_internet_only_is_empty() {
|
||||
let config = config_with_devices(vec![]);
|
||||
let result = generate(&config);
|
||||
assert!(result.lines().count() == 1); // only the header comment
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ipv4_subnet_rule() {
|
||||
let config = config_with_devices(vec!["cam".to_string()]);
|
||||
let result = generate(&config);
|
||||
assert!(result.contains("skyg_cam_drop_lan"));
|
||||
assert!(result.contains("option src_ip '10.0.13.0/24'"));
|
||||
assert!(result.contains("option dest_ip '10.0.0.0/16'"));
|
||||
assert!(result.contains("option target 'DROP'"));
|
||||
assert!(result.contains("option family 'ipv4'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ipv6_per_mac_rules() {
|
||||
let config = config_with_devices(vec!["cam".to_string()]);
|
||||
let result = generate(&config);
|
||||
assert!(result.contains("skyg_cam_drop_lan_v6"));
|
||||
assert!(result.contains("option src_mac 'aa:bb:cc:dd:ee:01'"));
|
||||
assert!(result.contains("option src_mac 'aa:bb:cc:dd:ee:02'"));
|
||||
assert!(result.contains("option dest_ip 'fd59:de0a:bff5::/48'"));
|
||||
assert!(result.contains("option family 'ipv6'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_unknown_network_is_skipped() {
|
||||
let config = config_with_devices(vec!["nonexistent".to_string()]);
|
||||
let result = generate(&config);
|
||||
assert!(result.lines().count() == 1); // only the header comment
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod dnsmasq;
|
||||
pub mod ethers;
|
||||
pub mod firewall;
|
||||
@@ -18,8 +18,9 @@ fn main() {
|
||||
let output = match cmd.as_str() {
|
||||
"dnsmasq" => generators::dnsmasq::generate(&config),
|
||||
"ethers" => generators::ethers::generate(&config),
|
||||
"firewall" => generators::firewall::generate(&config),
|
||||
_ => {
|
||||
eprintln!("usage: openwrt-gen <dnsmasq|ethers>");
|
||||
eprintln!("usage: openwrt-gen <dnsmasq|ethers|firewall>");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2,6 +2,10 @@ use crate::config::Device;
|
||||
|
||||
pub const ROOT_DOMAIN: &str = "internal";
|
||||
|
||||
// IPv6 ULA prefix assigned to br-lan (network.lan.ip6prefix). All subnets share
|
||||
// this single /64, so IPv6 internet-only blocking is done per-device MAC.
|
||||
pub const ULA_PREFIX: &str = "fd59:de0a:bff5::/48";
|
||||
|
||||
pub static IP_PREFIXES: &[(&str, &str)] = &[
|
||||
("lab", "10.0.10."),
|
||||
("k3s", "10.0.11."),
|
||||
@@ -99,4 +103,9 @@ mod tests {
|
||||
let result = process_network("devices", &devices);
|
||||
assert!(result[0].just_mac);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ula_prefix_constant() {
|
||||
assert_eq!(ULA_PREFIX, "fd59:de0a:bff5::/48");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user