Add config.site.net-combined

This commit is contained in:
Sandro - 2022-12-20 03:47:27 +01:00
parent 0e1ccff6ab
commit a510e60e4d
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
4 changed files with 27 additions and 15 deletions

View File

@ -1,4 +1,8 @@
{ lib, ... }: { config, lib, ... }:
let
concatMapAttrsRecursive = with lib; f: flip pipe [ (mapAttrs f) attrValues (foldl' recursiveUpdate { }) ];
in
{ {
imports = [ imports = [
# Secrets # Secrets
@ -9,7 +13,9 @@
./switch.nix ./switch.nix
./ap.nix ./ap.nix
./server.nix ./server.nix
] ++ ]
# IP networks # IP networks
lib.filesystem.listFilesRecursive ./net; ++ lib.filesystem.listFilesRecursive ./net;
site.net-combined = concatMapAttrsRecursive (name: value: { inherit (value) hosts4 hosts6; }) config.site.net;
} }

View File

@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1670700605, "lastModified": 1671501966,
"narHash": "sha256-5dlpATkcyITpdtMflhltuD+A3RNpsVI1Mb+dtKkll6Y=", "narHash": "sha256-lU7VRKyqWrkE71BmJXlPGOJX7IFiia1CS15HhVwr8L4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7b9eeb856cbf976482fa8d1cb295ea03fb3e1277", "rev": "333601f9a610632388e5613810f180babfbb7f53",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "release-22.05", "ref": "release-22.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -19,11 +19,11 @@
"openwrt": { "openwrt": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1670801318, "lastModified": 1671487822,
"narHash": "sha256-qhXRQ6pgDON7i1qvd6KjXgDlj8mY2cY9eG+pTJtZq/c=", "narHash": "sha256-92mcPLi2nICLpOseqdH9dDti81hkD47rJrQK48aMQl8=",
"ref": "openwrt-22.03", "ref": "openwrt-22.03",
"rev": "aef33ab13a294ba879d3d2f9407015feeb4e3908", "rev": "3de4572ed30865450047c0b2641afae20bcced15",
"revCount": 54439, "revCount": 54459,
"type": "git", "type": "git",
"url": "https://git.openwrt.org/openwrt/openwrt.git" "url": "https://git.openwrt.org/openwrt/openwrt.git"
}, },
@ -40,11 +40,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1671205751, "lastModified": 1671442525,
"narHash": "sha256-lpoeHn5HNkUOxhBpvK6aF/A0I9zQzTRAYxA0MAaSt+Y=", "narHash": "sha256-iC/SZW6kKEl/ystG/6dU7WBZmoCarpxHS/clp3Ep15g=",
"owner": "astro", "owner": "astro",
"repo": "nix-openwrt-imagebuilder", "repo": "nix-openwrt-imagebuilder",
"rev": "61d5a2a164b833837d0ac386afae3753806718d3", "rev": "cfc545f1776d7886559abb5f362281dfb147883f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -2,7 +2,7 @@
description = "Zentralwerk network"; description = "Zentralwerk network";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05"; nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
openwrt = { openwrt = {
url = "git+https://git.openwrt.org/openwrt/openwrt.git?ref=openwrt-22.03"; url = "git+https://git.openwrt.org/openwrt/openwrt.git?ref=openwrt-22.03";
flake = false; flake = false;

View File

@ -587,6 +587,12 @@ in
type = with types; attrsOf (submodule netOpts); type = with types; attrsOf (submodule netOpts);
}; };
net-combined = mkOption {
description = "All hosts of all subnets";
default = {};
type = with types; submodule netOpts;
};
hosts = mkOption { hosts = mkOption {
description = "All the static hosts"; description = "All the static hosts";
default = {}; default = {};