diff --git a/config/default.nix b/config/default.nix index 8fa9ff9..7c31f67 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,4 +1,8 @@ -{ lib, ... }: +{ config, lib, ... }: + +let + concatMapAttrsRecursive = with lib; f: flip pipe [ (mapAttrs f) attrValues (foldl' recursiveUpdate { }) ]; +in { imports = [ # Secrets @@ -9,7 +13,9 @@ ./switch.nix ./ap.nix ./server.nix - ] ++ + ] # IP networks - lib.filesystem.listFilesRecursive ./net; + ++ lib.filesystem.listFilesRecursive ./net; + + site.net-combined = concatMapAttrsRecursive (name: value: { inherit (value) hosts4 hosts6; }) config.site.net; } diff --git a/flake.lock b/flake.lock index 615f1f2..9f94c96 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1670700605, - "narHash": "sha256-5dlpATkcyITpdtMflhltuD+A3RNpsVI1Mb+dtKkll6Y=", + "lastModified": 1671501966, + "narHash": "sha256-lU7VRKyqWrkE71BmJXlPGOJX7IFiia1CS15HhVwr8L4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7b9eeb856cbf976482fa8d1cb295ea03fb3e1277", + "rev": "333601f9a610632388e5613810f180babfbb7f53", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-22.05", + "ref": "release-22.11", "repo": "nixpkgs", "type": "github" } @@ -19,11 +19,11 @@ "openwrt": { "flake": false, "locked": { - "lastModified": 1670801318, - "narHash": "sha256-qhXRQ6pgDON7i1qvd6KjXgDlj8mY2cY9eG+pTJtZq/c=", + "lastModified": 1671487822, + "narHash": "sha256-92mcPLi2nICLpOseqdH9dDti81hkD47rJrQK48aMQl8=", "ref": "openwrt-22.03", - "rev": "aef33ab13a294ba879d3d2f9407015feeb4e3908", - "revCount": 54439, + "rev": "3de4572ed30865450047c0b2641afae20bcced15", + "revCount": 54459, "type": "git", "url": "https://git.openwrt.org/openwrt/openwrt.git" }, @@ -40,11 +40,11 @@ ] }, "locked": { - "lastModified": 1671205751, - "narHash": "sha256-lpoeHn5HNkUOxhBpvK6aF/A0I9zQzTRAYxA0MAaSt+Y=", + "lastModified": 1671442525, + "narHash": "sha256-iC/SZW6kKEl/ystG/6dU7WBZmoCarpxHS/clp3Ep15g=", "owner": "astro", "repo": "nix-openwrt-imagebuilder", - "rev": "61d5a2a164b833837d0ac386afae3753806718d3", + "rev": "cfc545f1776d7886559abb5f362281dfb147883f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 48ccab2..9920851 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Zentralwerk network"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/release-22.05"; + nixpkgs.url = "github:NixOS/nixpkgs/release-22.11"; openwrt = { url = "git+https://git.openwrt.org/openwrt/openwrt.git?ref=openwrt-22.03"; flake = false; diff --git a/nix/lib/config/options.nix b/nix/lib/config/options.nix index 69d3859..dbd79e4 100644 --- a/nix/lib/config/options.nix +++ b/nix/lib/config/options.nix @@ -587,6 +587,12 @@ in type = with types; attrsOf (submodule netOpts); }; + net-combined = mkOption { + description = "All hosts of all subnets"; + default = {}; + type = with types; submodule netOpts; + }; + hosts = mkOption { description = "All the static hosts"; default = {};