├── .envrc ├── .github └── workflows │ └── ci.yaml ├── .gitignore ├── LICENSE.md ├── README.md ├── cli ├── Cargo.lock ├── Cargo.toml ├── exportips.json └── src │ └── main.rs ├── docs └── README.md ├── example ├── ipam │ ├── devices.json │ ├── domains.json │ └── ip-addresses.json └── nixbox.nix ├── flake.lock ├── flake.nix ├── modules ├── common.nix ├── devices.nix ├── domains.nix ├── interfaces.nix ├── ip-addresses.nix ├── nixbox.nix ├── service-template.nix └── subnets.nix └── utils ├── builder.nix ├── datafile.json ├── default.nix ├── networking.nix ├── templates.nix ├── tests └── networking.nix └── types.nix /.envrc: -------------------------------------------------------------------------------- 1 | use flake 2 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | pull_request: 4 | jobs: 5 | ci: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v3 9 | - uses: DeterminateSystems/nix-installer-action@main 10 | with: 11 | diagnostic-endpoint: "" 12 | - uses: DeterminateSystems/magic-nix-cache-action@main 13 | with: 14 | diagnostic-endpoint: "" 15 | 16 | - name: "Check evaluation" 17 | run: nix flake check --all-systems 18 | 19 | - name: "Run unit-tests" 20 | run: nix run github:nix-community/nix-unit -- --flake .#tests 21 | 22 | - name: "Do linting" 23 | run: nix run nixpkgs#statix -- check . 24 | 25 | - name: "Check formatting" 26 | run: nix fmt -- --check . 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .direnv 2 | /book 3 | result 4 | target 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024 Janik Haag. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NixBox 2 | 3 | A very work in progress NixOS IPAM implantation. 4 | Trying to integrate with NetBox. 5 | 6 | NetBox doesn't model routing topology which sucks for us since we want to know things like the default-gateway to dynamically generate NixOS config. 7 | There are quite a few issues about it, see: 8 | - https://github.com/netbox-community/netbox/discussions/6030 9 | 10 | 11 | ## Usage 12 | 13 | You can follow the usage examples, since we can just interact with the demo instance at https://demo.netbox.dev 14 | The login credentials are admin:admin 15 | 16 | ### Export data from an existing NetBox instance 17 | 18 | First we need to get a api token to authenticate against the api. 19 | And store it in `NIXBOX_NETBOX_TOKEN` so NixBox can use it: 20 | ```bash 21 | export NIXBOX_NETBOX_TOKEN=$(curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json; indent=4" https://demo.netbox.dev/api/users/tokens/provision/ --data '{ "username": "admin", "password": "admin" }' | jq -r -e .key) 22 | ``` 23 | 24 | Now you can run the NixBox CLI to fetch the data: 25 | ```bash 26 | nix run github:Janik-Haag/nixbox -- export 27 | ``` 28 | 29 | ### Import data into netbox 30 | 31 | NetBox has a concept called datafiles/datasources, you can read about the [here](https://docs.netbox.dev/en/stable/models/core/datafile/) 32 | Currently they only provide a structured interface for importing files, but I'm planning on adding synchronization support to NetBox, 33 | which shouldn't be too hard to pull of since most of the required infrastructure already exists. 34 | 35 | In the meantime you can build a demo data file with: 36 | ```bash 37 | nix build github:Janik-Haag/nixbox#dataSourceDemo 38 | ``` 39 | 40 | This will result in: 41 | ``` 42 | ./result 43 | └── address 44 | ``` 45 | 46 | You can now go ahead and upload the file on to the demo instance [here](https://demo.netbox.dev/ipam/ip-addresses/import/#tab_upload-form) 47 | And see that it successfully imports the objects from `./example/ipam/ip-addresses.json`. 48 | -------------------------------------------------------------------------------- /cli/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "anstream" 31 | version = "0.6.5" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" 34 | dependencies = [ 35 | "anstyle", 36 | "anstyle-parse", 37 | "anstyle-query", 38 | "anstyle-wincon", 39 | "colorchoice", 40 | "utf8parse", 41 | ] 42 | 43 | [[package]] 44 | name = "anstyle" 45 | version = "1.0.4" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" 48 | 49 | [[package]] 50 | name = "anstyle-parse" 51 | version = "0.2.3" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" 54 | dependencies = [ 55 | "utf8parse", 56 | ] 57 | 58 | [[package]] 59 | name = "anstyle-query" 60 | version = "1.0.2" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" 63 | dependencies = [ 64 | "windows-sys 0.52.0", 65 | ] 66 | 67 | [[package]] 68 | name = "anstyle-wincon" 69 | version = "3.0.2" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" 72 | dependencies = [ 73 | "anstyle", 74 | "windows-sys 0.52.0", 75 | ] 76 | 77 | [[package]] 78 | name = "autocfg" 79 | version = "1.1.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 82 | 83 | [[package]] 84 | name = "backtrace" 85 | version = "0.3.69" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" 88 | dependencies = [ 89 | "addr2line", 90 | "cc", 91 | "cfg-if", 92 | "libc", 93 | "miniz_oxide", 94 | "object", 95 | "rustc-demangle", 96 | ] 97 | 98 | [[package]] 99 | name = "base64" 100 | version = "0.21.5" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" 103 | 104 | [[package]] 105 | name = "bit-set" 106 | version = "0.5.3" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" 109 | dependencies = [ 110 | "bit-vec", 111 | ] 112 | 113 | [[package]] 114 | name = "bit-vec" 115 | version = "0.6.3" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" 118 | 119 | [[package]] 120 | name = "bitflags" 121 | version = "1.3.2" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 124 | 125 | [[package]] 126 | name = "bitflags" 127 | version = "2.4.1" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 130 | 131 | [[package]] 132 | name = "bitmaps" 133 | version = "3.2.0" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "703642b98a00b3b90513279a8ede3fcfa479c126c5fb46e78f3051522f021403" 136 | 137 | [[package]] 138 | name = "bumpalo" 139 | version = "3.14.0" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" 142 | 143 | [[package]] 144 | name = "bytes" 145 | version = "1.5.0" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 148 | 149 | [[package]] 150 | name = "cc" 151 | version = "1.0.83" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 154 | dependencies = [ 155 | "libc", 156 | ] 157 | 158 | [[package]] 159 | name = "cfg-if" 160 | version = "1.0.0" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 163 | 164 | [[package]] 165 | name = "clap" 166 | version = "4.4.13" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" 169 | dependencies = [ 170 | "clap_builder", 171 | "clap_derive", 172 | ] 173 | 174 | [[package]] 175 | name = "clap_builder" 176 | version = "4.4.12" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" 179 | dependencies = [ 180 | "anstream", 181 | "anstyle", 182 | "clap_lex", 183 | "strsim", 184 | ] 185 | 186 | [[package]] 187 | name = "clap_derive" 188 | version = "4.4.7" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" 191 | dependencies = [ 192 | "heck", 193 | "proc-macro2", 194 | "quote", 195 | "syn 2.0.48", 196 | ] 197 | 198 | [[package]] 199 | name = "clap_lex" 200 | version = "0.6.0" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" 203 | 204 | [[package]] 205 | name = "codemap" 206 | version = "0.1.3" 207 | source = "registry+https://github.com/rust-lang/crates.io-index" 208 | checksum = "b9e769b5c8c8283982a987c6e948e540254f1058d5a74b8794914d4ef5fc2a24" 209 | 210 | [[package]] 211 | name = "codemap-diagnostic" 212 | version = "0.1.2" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "cc20770be05b566a963bf91505e60412c4a2d016d1ef95c5512823bb085a8122" 215 | dependencies = [ 216 | "codemap", 217 | "termcolor", 218 | ] 219 | 220 | [[package]] 221 | name = "colorchoice" 222 | version = "1.0.0" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 225 | 226 | [[package]] 227 | name = "core-foundation" 228 | version = "0.9.4" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 231 | dependencies = [ 232 | "core-foundation-sys", 233 | "libc", 234 | ] 235 | 236 | [[package]] 237 | name = "core-foundation-sys" 238 | version = "0.8.6" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" 241 | 242 | [[package]] 243 | name = "countme" 244 | version = "3.0.1" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" 247 | 248 | [[package]] 249 | name = "dirs" 250 | version = "4.0.0" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" 253 | dependencies = [ 254 | "dirs-sys", 255 | ] 256 | 257 | [[package]] 258 | name = "dirs-sys" 259 | version = "0.3.7" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 262 | dependencies = [ 263 | "libc", 264 | "redox_users", 265 | "winapi", 266 | ] 267 | 268 | [[package]] 269 | name = "encoding_rs" 270 | version = "0.8.33" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" 273 | dependencies = [ 274 | "cfg-if", 275 | ] 276 | 277 | [[package]] 278 | name = "equivalent" 279 | version = "1.0.1" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 282 | 283 | [[package]] 284 | name = "errno" 285 | version = "0.3.8" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" 288 | dependencies = [ 289 | "libc", 290 | "windows-sys 0.52.0", 291 | ] 292 | 293 | [[package]] 294 | name = "fastrand" 295 | version = "2.0.1" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" 298 | 299 | [[package]] 300 | name = "fnv" 301 | version = "1.0.7" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 304 | 305 | [[package]] 306 | name = "foreign-types" 307 | version = "0.3.2" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 310 | dependencies = [ 311 | "foreign-types-shared", 312 | ] 313 | 314 | [[package]] 315 | name = "foreign-types-shared" 316 | version = "0.1.1" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 319 | 320 | [[package]] 321 | name = "form_urlencoded" 322 | version = "1.2.1" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 325 | dependencies = [ 326 | "percent-encoding", 327 | ] 328 | 329 | [[package]] 330 | name = "futures-channel" 331 | version = "0.3.30" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" 334 | dependencies = [ 335 | "futures-core", 336 | ] 337 | 338 | [[package]] 339 | name = "futures-core" 340 | version = "0.3.30" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 343 | 344 | [[package]] 345 | name = "futures-io" 346 | version = "0.3.30" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" 349 | 350 | [[package]] 351 | name = "futures-sink" 352 | version = "0.3.30" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" 355 | 356 | [[package]] 357 | name = "futures-task" 358 | version = "0.3.30" 359 | source = "registry+https://github.com/rust-lang/crates.io-index" 360 | checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" 361 | 362 | [[package]] 363 | name = "futures-util" 364 | version = "0.3.30" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" 367 | dependencies = [ 368 | "futures-core", 369 | "futures-io", 370 | "futures-task", 371 | "memchr", 372 | "pin-project-lite", 373 | "pin-utils", 374 | "slab", 375 | ] 376 | 377 | [[package]] 378 | name = "genawaiter" 379 | version = "0.99.1" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "c86bd0361bcbde39b13475e6e36cb24c329964aa2611be285289d1e4b751c1a0" 382 | dependencies = [ 383 | "genawaiter-macro", 384 | ] 385 | 386 | [[package]] 387 | name = "genawaiter-macro" 388 | version = "0.99.1" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "0b32dfe1fdfc0bbde1f22a5da25355514b5e450c33a6af6770884c8750aedfbc" 391 | 392 | [[package]] 393 | name = "getrandom" 394 | version = "0.2.11" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" 397 | dependencies = [ 398 | "cfg-if", 399 | "libc", 400 | "wasi", 401 | ] 402 | 403 | [[package]] 404 | name = "gimli" 405 | version = "0.28.1" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" 408 | 409 | [[package]] 410 | name = "h2" 411 | version = "0.3.22" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" 414 | dependencies = [ 415 | "bytes", 416 | "fnv", 417 | "futures-core", 418 | "futures-sink", 419 | "futures-util", 420 | "http", 421 | "indexmap 2.1.0", 422 | "slab", 423 | "tokio", 424 | "tokio-util", 425 | "tracing", 426 | ] 427 | 428 | [[package]] 429 | name = "hashbrown" 430 | version = "0.12.3" 431 | source = "registry+https://github.com/rust-lang/crates.io-index" 432 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 433 | 434 | [[package]] 435 | name = "hashbrown" 436 | version = "0.14.3" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" 439 | 440 | [[package]] 441 | name = "heck" 442 | version = "0.4.1" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 445 | 446 | [[package]] 447 | name = "hermit-abi" 448 | version = "0.3.3" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" 451 | 452 | [[package]] 453 | name = "http" 454 | version = "0.2.11" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" 457 | dependencies = [ 458 | "bytes", 459 | "fnv", 460 | "itoa", 461 | ] 462 | 463 | [[package]] 464 | name = "http-body" 465 | version = "0.4.6" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" 468 | dependencies = [ 469 | "bytes", 470 | "http", 471 | "pin-project-lite", 472 | ] 473 | 474 | [[package]] 475 | name = "httparse" 476 | version = "1.8.0" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 479 | 480 | [[package]] 481 | name = "httpdate" 482 | version = "1.0.3" 483 | source = "registry+https://github.com/rust-lang/crates.io-index" 484 | checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" 485 | 486 | [[package]] 487 | name = "hyper" 488 | version = "0.14.28" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" 491 | dependencies = [ 492 | "bytes", 493 | "futures-channel", 494 | "futures-core", 495 | "futures-util", 496 | "h2", 497 | "http", 498 | "http-body", 499 | "httparse", 500 | "httpdate", 501 | "itoa", 502 | "pin-project-lite", 503 | "socket2", 504 | "tokio", 505 | "tower-service", 506 | "tracing", 507 | "want", 508 | ] 509 | 510 | [[package]] 511 | name = "hyper-tls" 512 | version = "0.5.0" 513 | source = "registry+https://github.com/rust-lang/crates.io-index" 514 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 515 | dependencies = [ 516 | "bytes", 517 | "hyper", 518 | "native-tls", 519 | "tokio", 520 | "tokio-native-tls", 521 | ] 522 | 523 | [[package]] 524 | name = "idna" 525 | version = "0.5.0" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 528 | dependencies = [ 529 | "unicode-bidi", 530 | "unicode-normalization", 531 | ] 532 | 533 | [[package]] 534 | name = "imbl" 535 | version = "2.0.3" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "978d142c8028edf52095703af2fad11d6f611af1246685725d6b850634647085" 538 | dependencies = [ 539 | "bitmaps", 540 | "imbl-sized-chunks", 541 | "proptest", 542 | "rand_core", 543 | "rand_xoshiro", 544 | "serde", 545 | "version_check", 546 | ] 547 | 548 | [[package]] 549 | name = "imbl-sized-chunks" 550 | version = "0.1.1" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | checksum = "e6957ea0b2541c5ca561d3ef4538044af79f8a05a1eb3a3b148936aaceaa1076" 553 | dependencies = [ 554 | "bitmaps", 555 | ] 556 | 557 | [[package]] 558 | name = "indexmap" 559 | version = "1.9.3" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 562 | dependencies = [ 563 | "autocfg", 564 | "hashbrown 0.12.3", 565 | ] 566 | 567 | [[package]] 568 | name = "indexmap" 569 | version = "2.1.0" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" 572 | dependencies = [ 573 | "equivalent", 574 | "hashbrown 0.14.3", 575 | ] 576 | 577 | [[package]] 578 | name = "ipnet" 579 | version = "2.9.0" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" 582 | 583 | [[package]] 584 | name = "itoa" 585 | version = "1.0.10" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" 588 | 589 | [[package]] 590 | name = "js-sys" 591 | version = "0.3.66" 592 | source = "registry+https://github.com/rust-lang/crates.io-index" 593 | checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" 594 | dependencies = [ 595 | "wasm-bindgen", 596 | ] 597 | 598 | [[package]] 599 | name = "lazy_static" 600 | version = "1.4.0" 601 | source = "registry+https://github.com/rust-lang/crates.io-index" 602 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 603 | 604 | [[package]] 605 | name = "lexical-core" 606 | version = "0.8.5" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" 609 | dependencies = [ 610 | "lexical-parse-float", 611 | "lexical-parse-integer", 612 | "lexical-util", 613 | "lexical-write-float", 614 | "lexical-write-integer", 615 | ] 616 | 617 | [[package]] 618 | name = "lexical-parse-float" 619 | version = "0.8.5" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" 622 | dependencies = [ 623 | "lexical-parse-integer", 624 | "lexical-util", 625 | "static_assertions", 626 | ] 627 | 628 | [[package]] 629 | name = "lexical-parse-integer" 630 | version = "0.8.6" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" 633 | dependencies = [ 634 | "lexical-util", 635 | "static_assertions", 636 | ] 637 | 638 | [[package]] 639 | name = "lexical-util" 640 | version = "0.8.5" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" 643 | dependencies = [ 644 | "static_assertions", 645 | ] 646 | 647 | [[package]] 648 | name = "lexical-write-float" 649 | version = "0.8.5" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" 652 | dependencies = [ 653 | "lexical-util", 654 | "lexical-write-integer", 655 | "static_assertions", 656 | ] 657 | 658 | [[package]] 659 | name = "lexical-write-integer" 660 | version = "0.8.5" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" 663 | dependencies = [ 664 | "lexical-util", 665 | "static_assertions", 666 | ] 667 | 668 | [[package]] 669 | name = "libc" 670 | version = "0.2.151" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" 673 | 674 | [[package]] 675 | name = "libm" 676 | version = "0.2.8" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" 679 | 680 | [[package]] 681 | name = "libredox" 682 | version = "0.0.1" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" 685 | dependencies = [ 686 | "bitflags 2.4.1", 687 | "libc", 688 | "redox_syscall", 689 | ] 690 | 691 | [[package]] 692 | name = "linux-raw-sys" 693 | version = "0.4.12" 694 | source = "registry+https://github.com/rust-lang/crates.io-index" 695 | checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" 696 | 697 | [[package]] 698 | name = "lock_api" 699 | version = "0.4.11" 700 | source = "registry+https://github.com/rust-lang/crates.io-index" 701 | checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" 702 | dependencies = [ 703 | "autocfg", 704 | "scopeguard", 705 | ] 706 | 707 | [[package]] 708 | name = "log" 709 | version = "0.4.20" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 712 | 713 | [[package]] 714 | name = "memchr" 715 | version = "2.7.1" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" 718 | 719 | [[package]] 720 | name = "memoffset" 721 | version = "0.9.0" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" 724 | dependencies = [ 725 | "autocfg", 726 | ] 727 | 728 | [[package]] 729 | name = "mime" 730 | version = "0.3.17" 731 | source = "registry+https://github.com/rust-lang/crates.io-index" 732 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 733 | 734 | [[package]] 735 | name = "miniz_oxide" 736 | version = "0.7.1" 737 | source = "registry+https://github.com/rust-lang/crates.io-index" 738 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 739 | dependencies = [ 740 | "adler", 741 | ] 742 | 743 | [[package]] 744 | name = "mio" 745 | version = "0.8.10" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" 748 | dependencies = [ 749 | "libc", 750 | "wasi", 751 | "windows-sys 0.48.0", 752 | ] 753 | 754 | [[package]] 755 | name = "native-tls" 756 | version = "0.2.11" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 759 | dependencies = [ 760 | "lazy_static", 761 | "libc", 762 | "log", 763 | "openssl", 764 | "openssl-probe", 765 | "openssl-sys", 766 | "schannel", 767 | "security-framework", 768 | "security-framework-sys", 769 | "tempfile", 770 | ] 771 | 772 | [[package]] 773 | name = "nixbox" 774 | version = "0.1.0" 775 | dependencies = [ 776 | "clap", 777 | "reqwest", 778 | "serde", 779 | "serde_json", 780 | "tokio", 781 | "tvix-serde", 782 | ] 783 | 784 | [[package]] 785 | name = "nom8" 786 | version = "0.2.0" 787 | source = "registry+https://github.com/rust-lang/crates.io-index" 788 | checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" 789 | dependencies = [ 790 | "memchr", 791 | ] 792 | 793 | [[package]] 794 | name = "num-traits" 795 | version = "0.2.17" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 798 | dependencies = [ 799 | "autocfg", 800 | "libm", 801 | ] 802 | 803 | [[package]] 804 | name = "num_cpus" 805 | version = "1.16.0" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 808 | dependencies = [ 809 | "hermit-abi", 810 | "libc", 811 | ] 812 | 813 | [[package]] 814 | name = "object" 815 | version = "0.32.2" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" 818 | dependencies = [ 819 | "memchr", 820 | ] 821 | 822 | [[package]] 823 | name = "once_cell" 824 | version = "1.19.0" 825 | source = "registry+https://github.com/rust-lang/crates.io-index" 826 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 827 | 828 | [[package]] 829 | name = "openssl" 830 | version = "0.10.62" 831 | source = "registry+https://github.com/rust-lang/crates.io-index" 832 | checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" 833 | dependencies = [ 834 | "bitflags 2.4.1", 835 | "cfg-if", 836 | "foreign-types", 837 | "libc", 838 | "once_cell", 839 | "openssl-macros", 840 | "openssl-sys", 841 | ] 842 | 843 | [[package]] 844 | name = "openssl-macros" 845 | version = "0.1.1" 846 | source = "registry+https://github.com/rust-lang/crates.io-index" 847 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 848 | dependencies = [ 849 | "proc-macro2", 850 | "quote", 851 | "syn 2.0.48", 852 | ] 853 | 854 | [[package]] 855 | name = "openssl-probe" 856 | version = "0.1.5" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 859 | 860 | [[package]] 861 | name = "openssl-sys" 862 | version = "0.9.98" 863 | source = "registry+https://github.com/rust-lang/crates.io-index" 864 | checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" 865 | dependencies = [ 866 | "cc", 867 | "libc", 868 | "pkg-config", 869 | "vcpkg", 870 | ] 871 | 872 | [[package]] 873 | name = "parking_lot" 874 | version = "0.12.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 877 | dependencies = [ 878 | "lock_api", 879 | "parking_lot_core", 880 | ] 881 | 882 | [[package]] 883 | name = "parking_lot_core" 884 | version = "0.9.9" 885 | source = "registry+https://github.com/rust-lang/crates.io-index" 886 | checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" 887 | dependencies = [ 888 | "cfg-if", 889 | "libc", 890 | "redox_syscall", 891 | "smallvec", 892 | "windows-targets 0.48.5", 893 | ] 894 | 895 | [[package]] 896 | name = "path-clean" 897 | version = "0.1.0" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" 900 | 901 | [[package]] 902 | name = "percent-encoding" 903 | version = "2.3.1" 904 | source = "registry+https://github.com/rust-lang/crates.io-index" 905 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 906 | 907 | [[package]] 908 | name = "pin-project-lite" 909 | version = "0.2.13" 910 | source = "registry+https://github.com/rust-lang/crates.io-index" 911 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 912 | 913 | [[package]] 914 | name = "pin-utils" 915 | version = "0.1.0" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 918 | 919 | [[package]] 920 | name = "pkg-config" 921 | version = "0.3.28" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" 924 | 925 | [[package]] 926 | name = "ppv-lite86" 927 | version = "0.2.17" 928 | source = "registry+https://github.com/rust-lang/crates.io-index" 929 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 930 | 931 | [[package]] 932 | name = "proc-macro2" 933 | version = "1.0.76" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" 936 | dependencies = [ 937 | "unicode-ident", 938 | ] 939 | 940 | [[package]] 941 | name = "proptest" 942 | version = "1.4.0" 943 | source = "registry+https://github.com/rust-lang/crates.io-index" 944 | checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" 945 | dependencies = [ 946 | "bit-set", 947 | "bit-vec", 948 | "bitflags 2.4.1", 949 | "lazy_static", 950 | "num-traits", 951 | "rand", 952 | "rand_chacha", 953 | "rand_xorshift", 954 | "regex-syntax", 955 | "rusty-fork", 956 | "tempfile", 957 | "unarray", 958 | ] 959 | 960 | [[package]] 961 | name = "quick-error" 962 | version = "1.2.3" 963 | source = "registry+https://github.com/rust-lang/crates.io-index" 964 | checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" 965 | 966 | [[package]] 967 | name = "quote" 968 | version = "1.0.35" 969 | source = "registry+https://github.com/rust-lang/crates.io-index" 970 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 971 | dependencies = [ 972 | "proc-macro2", 973 | ] 974 | 975 | [[package]] 976 | name = "rand" 977 | version = "0.8.5" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 980 | dependencies = [ 981 | "libc", 982 | "rand_chacha", 983 | "rand_core", 984 | ] 985 | 986 | [[package]] 987 | name = "rand_chacha" 988 | version = "0.3.1" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 991 | dependencies = [ 992 | "ppv-lite86", 993 | "rand_core", 994 | ] 995 | 996 | [[package]] 997 | name = "rand_core" 998 | version = "0.6.4" 999 | source = "registry+https://github.com/rust-lang/crates.io-index" 1000 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1001 | dependencies = [ 1002 | "getrandom", 1003 | ] 1004 | 1005 | [[package]] 1006 | name = "rand_xorshift" 1007 | version = "0.3.0" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" 1010 | dependencies = [ 1011 | "rand_core", 1012 | ] 1013 | 1014 | [[package]] 1015 | name = "rand_xoshiro" 1016 | version = "0.6.0" 1017 | source = "registry+https://github.com/rust-lang/crates.io-index" 1018 | checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" 1019 | dependencies = [ 1020 | "rand_core", 1021 | ] 1022 | 1023 | [[package]] 1024 | name = "redox_syscall" 1025 | version = "0.4.1" 1026 | source = "registry+https://github.com/rust-lang/crates.io-index" 1027 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 1028 | dependencies = [ 1029 | "bitflags 1.3.2", 1030 | ] 1031 | 1032 | [[package]] 1033 | name = "redox_users" 1034 | version = "0.4.4" 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" 1036 | checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" 1037 | dependencies = [ 1038 | "getrandom", 1039 | "libredox", 1040 | "thiserror", 1041 | ] 1042 | 1043 | [[package]] 1044 | name = "regex" 1045 | version = "1.10.2" 1046 | source = "registry+https://github.com/rust-lang/crates.io-index" 1047 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 1048 | dependencies = [ 1049 | "aho-corasick", 1050 | "memchr", 1051 | "regex-automata", 1052 | "regex-syntax", 1053 | ] 1054 | 1055 | [[package]] 1056 | name = "regex-automata" 1057 | version = "0.4.3" 1058 | source = "registry+https://github.com/rust-lang/crates.io-index" 1059 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 1060 | dependencies = [ 1061 | "aho-corasick", 1062 | "memchr", 1063 | "regex-syntax", 1064 | ] 1065 | 1066 | [[package]] 1067 | name = "regex-syntax" 1068 | version = "0.8.2" 1069 | source = "registry+https://github.com/rust-lang/crates.io-index" 1070 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 1071 | 1072 | [[package]] 1073 | name = "reqwest" 1074 | version = "0.11.23" 1075 | source = "registry+https://github.com/rust-lang/crates.io-index" 1076 | checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" 1077 | dependencies = [ 1078 | "base64", 1079 | "bytes", 1080 | "encoding_rs", 1081 | "futures-core", 1082 | "futures-util", 1083 | "h2", 1084 | "http", 1085 | "http-body", 1086 | "hyper", 1087 | "hyper-tls", 1088 | "ipnet", 1089 | "js-sys", 1090 | "log", 1091 | "mime", 1092 | "native-tls", 1093 | "once_cell", 1094 | "percent-encoding", 1095 | "pin-project-lite", 1096 | "serde", 1097 | "serde_json", 1098 | "serde_urlencoded", 1099 | "system-configuration", 1100 | "tokio", 1101 | "tokio-native-tls", 1102 | "tower-service", 1103 | "url", 1104 | "wasm-bindgen", 1105 | "wasm-bindgen-futures", 1106 | "web-sys", 1107 | "winreg", 1108 | ] 1109 | 1110 | [[package]] 1111 | name = "rnix" 1112 | version = "0.11.0" 1113 | source = "registry+https://github.com/rust-lang/crates.io-index" 1114 | checksum = "bb35cedbeb70e0ccabef2a31bcff0aebd114f19566086300b8f42c725fc2cb5f" 1115 | dependencies = [ 1116 | "rowan", 1117 | ] 1118 | 1119 | [[package]] 1120 | name = "rowan" 1121 | version = "0.15.15" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "32a58fa8a7ccff2aec4f39cc45bf5f985cec7125ab271cf681c279fd00192b49" 1124 | dependencies = [ 1125 | "countme", 1126 | "hashbrown 0.14.3", 1127 | "memoffset", 1128 | "rustc-hash", 1129 | "text-size", 1130 | ] 1131 | 1132 | [[package]] 1133 | name = "rustc-demangle" 1134 | version = "0.1.23" 1135 | source = "registry+https://github.com/rust-lang/crates.io-index" 1136 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 1137 | 1138 | [[package]] 1139 | name = "rustc-hash" 1140 | version = "1.1.0" 1141 | source = "registry+https://github.com/rust-lang/crates.io-index" 1142 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" 1143 | 1144 | [[package]] 1145 | name = "rustix" 1146 | version = "0.38.28" 1147 | source = "registry+https://github.com/rust-lang/crates.io-index" 1148 | checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" 1149 | dependencies = [ 1150 | "bitflags 2.4.1", 1151 | "errno", 1152 | "libc", 1153 | "linux-raw-sys", 1154 | "windows-sys 0.52.0", 1155 | ] 1156 | 1157 | [[package]] 1158 | name = "rusty-fork" 1159 | version = "0.3.0" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" 1162 | dependencies = [ 1163 | "fnv", 1164 | "quick-error", 1165 | "tempfile", 1166 | "wait-timeout", 1167 | ] 1168 | 1169 | [[package]] 1170 | name = "ryu" 1171 | version = "1.0.16" 1172 | source = "registry+https://github.com/rust-lang/crates.io-index" 1173 | checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" 1174 | 1175 | [[package]] 1176 | name = "schannel" 1177 | version = "0.1.23" 1178 | source = "registry+https://github.com/rust-lang/crates.io-index" 1179 | checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" 1180 | dependencies = [ 1181 | "windows-sys 0.52.0", 1182 | ] 1183 | 1184 | [[package]] 1185 | name = "scopeguard" 1186 | version = "1.2.0" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1189 | 1190 | [[package]] 1191 | name = "security-framework" 1192 | version = "2.9.2" 1193 | source = "registry+https://github.com/rust-lang/crates.io-index" 1194 | checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" 1195 | dependencies = [ 1196 | "bitflags 1.3.2", 1197 | "core-foundation", 1198 | "core-foundation-sys", 1199 | "libc", 1200 | "security-framework-sys", 1201 | ] 1202 | 1203 | [[package]] 1204 | name = "security-framework-sys" 1205 | version = "2.9.1" 1206 | source = "registry+https://github.com/rust-lang/crates.io-index" 1207 | checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" 1208 | dependencies = [ 1209 | "core-foundation-sys", 1210 | "libc", 1211 | ] 1212 | 1213 | [[package]] 1214 | name = "serde" 1215 | version = "1.0.195" 1216 | source = "registry+https://github.com/rust-lang/crates.io-index" 1217 | checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" 1218 | dependencies = [ 1219 | "serde_derive", 1220 | ] 1221 | 1222 | [[package]] 1223 | name = "serde_derive" 1224 | version = "1.0.195" 1225 | source = "registry+https://github.com/rust-lang/crates.io-index" 1226 | checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" 1227 | dependencies = [ 1228 | "proc-macro2", 1229 | "quote", 1230 | "syn 2.0.48", 1231 | ] 1232 | 1233 | [[package]] 1234 | name = "serde_json" 1235 | version = "1.0.111" 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" 1237 | checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" 1238 | dependencies = [ 1239 | "itoa", 1240 | "ryu", 1241 | "serde", 1242 | ] 1243 | 1244 | [[package]] 1245 | name = "serde_spanned" 1246 | version = "0.6.5" 1247 | source = "registry+https://github.com/rust-lang/crates.io-index" 1248 | checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" 1249 | dependencies = [ 1250 | "serde", 1251 | ] 1252 | 1253 | [[package]] 1254 | name = "serde_urlencoded" 1255 | version = "0.7.1" 1256 | source = "registry+https://github.com/rust-lang/crates.io-index" 1257 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1258 | dependencies = [ 1259 | "form_urlencoded", 1260 | "itoa", 1261 | "ryu", 1262 | "serde", 1263 | ] 1264 | 1265 | [[package]] 1266 | name = "signal-hook-registry" 1267 | version = "1.4.1" 1268 | source = "registry+https://github.com/rust-lang/crates.io-index" 1269 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 1270 | dependencies = [ 1271 | "libc", 1272 | ] 1273 | 1274 | [[package]] 1275 | name = "slab" 1276 | version = "0.4.9" 1277 | source = "registry+https://github.com/rust-lang/crates.io-index" 1278 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 1279 | dependencies = [ 1280 | "autocfg", 1281 | ] 1282 | 1283 | [[package]] 1284 | name = "smallvec" 1285 | version = "1.11.2" 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" 1287 | checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" 1288 | 1289 | [[package]] 1290 | name = "smol_str" 1291 | version = "0.2.0" 1292 | source = "registry+https://github.com/rust-lang/crates.io-index" 1293 | checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" 1294 | dependencies = [ 1295 | "serde", 1296 | ] 1297 | 1298 | [[package]] 1299 | name = "socket2" 1300 | version = "0.5.5" 1301 | source = "registry+https://github.com/rust-lang/crates.io-index" 1302 | checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" 1303 | dependencies = [ 1304 | "libc", 1305 | "windows-sys 0.48.0", 1306 | ] 1307 | 1308 | [[package]] 1309 | name = "static_assertions" 1310 | version = "1.1.0" 1311 | source = "registry+https://github.com/rust-lang/crates.io-index" 1312 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1313 | 1314 | [[package]] 1315 | name = "strsim" 1316 | version = "0.10.0" 1317 | source = "registry+https://github.com/rust-lang/crates.io-index" 1318 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1319 | 1320 | [[package]] 1321 | name = "structmeta" 1322 | version = "0.1.6" 1323 | source = "registry+https://github.com/rust-lang/crates.io-index" 1324 | checksum = "104842d6278bf64aa9d2f182ba4bde31e8aec7a131d29b7f444bb9b344a09e2a" 1325 | dependencies = [ 1326 | "proc-macro2", 1327 | "quote", 1328 | "structmeta-derive", 1329 | "syn 1.0.109", 1330 | ] 1331 | 1332 | [[package]] 1333 | name = "structmeta-derive" 1334 | version = "0.1.6" 1335 | source = "registry+https://github.com/rust-lang/crates.io-index" 1336 | checksum = "24420be405b590e2d746d83b01f09af673270cf80e9b003a5fa7b651c58c7d93" 1337 | dependencies = [ 1338 | "proc-macro2", 1339 | "quote", 1340 | "syn 1.0.109", 1341 | ] 1342 | 1343 | [[package]] 1344 | name = "syn" 1345 | version = "1.0.109" 1346 | source = "registry+https://github.com/rust-lang/crates.io-index" 1347 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1348 | dependencies = [ 1349 | "proc-macro2", 1350 | "quote", 1351 | "unicode-ident", 1352 | ] 1353 | 1354 | [[package]] 1355 | name = "syn" 1356 | version = "2.0.48" 1357 | source = "registry+https://github.com/rust-lang/crates.io-index" 1358 | checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" 1359 | dependencies = [ 1360 | "proc-macro2", 1361 | "quote", 1362 | "unicode-ident", 1363 | ] 1364 | 1365 | [[package]] 1366 | name = "system-configuration" 1367 | version = "0.5.1" 1368 | source = "registry+https://github.com/rust-lang/crates.io-index" 1369 | checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" 1370 | dependencies = [ 1371 | "bitflags 1.3.2", 1372 | "core-foundation", 1373 | "system-configuration-sys", 1374 | ] 1375 | 1376 | [[package]] 1377 | name = "system-configuration-sys" 1378 | version = "0.5.0" 1379 | source = "registry+https://github.com/rust-lang/crates.io-index" 1380 | checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" 1381 | dependencies = [ 1382 | "core-foundation-sys", 1383 | "libc", 1384 | ] 1385 | 1386 | [[package]] 1387 | name = "tabwriter" 1388 | version = "1.4.0" 1389 | source = "registry+https://github.com/rust-lang/crates.io-index" 1390 | checksum = "a327282c4f64f6dc37e3bba4c2b6842cc3a992f204fa58d917696a89f691e5f6" 1391 | dependencies = [ 1392 | "unicode-width", 1393 | ] 1394 | 1395 | [[package]] 1396 | name = "tempfile" 1397 | version = "3.9.0" 1398 | source = "registry+https://github.com/rust-lang/crates.io-index" 1399 | checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" 1400 | dependencies = [ 1401 | "cfg-if", 1402 | "fastrand", 1403 | "redox_syscall", 1404 | "rustix", 1405 | "windows-sys 0.52.0", 1406 | ] 1407 | 1408 | [[package]] 1409 | name = "termcolor" 1410 | version = "1.4.0" 1411 | source = "registry+https://github.com/rust-lang/crates.io-index" 1412 | checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" 1413 | dependencies = [ 1414 | "winapi-util", 1415 | ] 1416 | 1417 | [[package]] 1418 | name = "test-strategy" 1419 | version = "0.2.1" 1420 | source = "registry+https://github.com/rust-lang/crates.io-index" 1421 | checksum = "62d6408d1406657be2f9d1701fbae379331d30d2f6e92050710edb0d34eeb480" 1422 | dependencies = [ 1423 | "proc-macro2", 1424 | "quote", 1425 | "structmeta", 1426 | "syn 1.0.109", 1427 | ] 1428 | 1429 | [[package]] 1430 | name = "text-size" 1431 | version = "1.1.1" 1432 | source = "registry+https://github.com/rust-lang/crates.io-index" 1433 | checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" 1434 | 1435 | [[package]] 1436 | name = "thiserror" 1437 | version = "1.0.56" 1438 | source = "registry+https://github.com/rust-lang/crates.io-index" 1439 | checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" 1440 | dependencies = [ 1441 | "thiserror-impl", 1442 | ] 1443 | 1444 | [[package]] 1445 | name = "thiserror-impl" 1446 | version = "1.0.56" 1447 | source = "registry+https://github.com/rust-lang/crates.io-index" 1448 | checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" 1449 | dependencies = [ 1450 | "proc-macro2", 1451 | "quote", 1452 | "syn 2.0.48", 1453 | ] 1454 | 1455 | [[package]] 1456 | name = "tinyvec" 1457 | version = "1.6.0" 1458 | source = "registry+https://github.com/rust-lang/crates.io-index" 1459 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1460 | dependencies = [ 1461 | "tinyvec_macros", 1462 | ] 1463 | 1464 | [[package]] 1465 | name = "tinyvec_macros" 1466 | version = "0.1.1" 1467 | source = "registry+https://github.com/rust-lang/crates.io-index" 1468 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1469 | 1470 | [[package]] 1471 | name = "tokio" 1472 | version = "1.35.1" 1473 | source = "registry+https://github.com/rust-lang/crates.io-index" 1474 | checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" 1475 | dependencies = [ 1476 | "backtrace", 1477 | "bytes", 1478 | "libc", 1479 | "mio", 1480 | "num_cpus", 1481 | "parking_lot", 1482 | "pin-project-lite", 1483 | "signal-hook-registry", 1484 | "socket2", 1485 | "tokio-macros", 1486 | "windows-sys 0.48.0", 1487 | ] 1488 | 1489 | [[package]] 1490 | name = "tokio-macros" 1491 | version = "2.2.0" 1492 | source = "registry+https://github.com/rust-lang/crates.io-index" 1493 | checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" 1494 | dependencies = [ 1495 | "proc-macro2", 1496 | "quote", 1497 | "syn 2.0.48", 1498 | ] 1499 | 1500 | [[package]] 1501 | name = "tokio-native-tls" 1502 | version = "0.3.1" 1503 | source = "registry+https://github.com/rust-lang/crates.io-index" 1504 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1505 | dependencies = [ 1506 | "native-tls", 1507 | "tokio", 1508 | ] 1509 | 1510 | [[package]] 1511 | name = "tokio-util" 1512 | version = "0.7.10" 1513 | source = "registry+https://github.com/rust-lang/crates.io-index" 1514 | checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" 1515 | dependencies = [ 1516 | "bytes", 1517 | "futures-core", 1518 | "futures-sink", 1519 | "pin-project-lite", 1520 | "tokio", 1521 | "tracing", 1522 | ] 1523 | 1524 | [[package]] 1525 | name = "toml" 1526 | version = "0.6.0" 1527 | source = "registry+https://github.com/rust-lang/crates.io-index" 1528 | checksum = "4fb9d890e4dc9298b70f740f615f2e05b9db37dce531f6b24fb77ac993f9f217" 1529 | dependencies = [ 1530 | "serde", 1531 | "serde_spanned", 1532 | "toml_datetime", 1533 | "toml_edit", 1534 | ] 1535 | 1536 | [[package]] 1537 | name = "toml_datetime" 1538 | version = "0.5.1" 1539 | source = "registry+https://github.com/rust-lang/crates.io-index" 1540 | checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" 1541 | dependencies = [ 1542 | "serde", 1543 | ] 1544 | 1545 | [[package]] 1546 | name = "toml_edit" 1547 | version = "0.18.1" 1548 | source = "registry+https://github.com/rust-lang/crates.io-index" 1549 | checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" 1550 | dependencies = [ 1551 | "indexmap 1.9.3", 1552 | "nom8", 1553 | "serde", 1554 | "serde_spanned", 1555 | "toml_datetime", 1556 | ] 1557 | 1558 | [[package]] 1559 | name = "tower-service" 1560 | version = "0.3.2" 1561 | source = "registry+https://github.com/rust-lang/crates.io-index" 1562 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1563 | 1564 | [[package]] 1565 | name = "tracing" 1566 | version = "0.1.40" 1567 | source = "registry+https://github.com/rust-lang/crates.io-index" 1568 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 1569 | dependencies = [ 1570 | "pin-project-lite", 1571 | "tracing-core", 1572 | ] 1573 | 1574 | [[package]] 1575 | name = "tracing-core" 1576 | version = "0.1.32" 1577 | source = "registry+https://github.com/rust-lang/crates.io-index" 1578 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 1579 | dependencies = [ 1580 | "once_cell", 1581 | ] 1582 | 1583 | [[package]] 1584 | name = "try-lock" 1585 | version = "0.2.5" 1586 | source = "registry+https://github.com/rust-lang/crates.io-index" 1587 | checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 1588 | 1589 | [[package]] 1590 | name = "tvix-eval" 1591 | version = "0.1.0" 1592 | source = "git+https://github.com/tvlfyi/tvix.git#e1367fc0c65ecaa5d94f8e82c46cd6b104d0ee82" 1593 | dependencies = [ 1594 | "bytes", 1595 | "codemap", 1596 | "codemap-diagnostic", 1597 | "dirs", 1598 | "genawaiter", 1599 | "imbl", 1600 | "lazy_static", 1601 | "lexical-core", 1602 | "path-clean", 1603 | "proptest", 1604 | "regex", 1605 | "rnix", 1606 | "rowan", 1607 | "serde", 1608 | "serde_json", 1609 | "smol_str", 1610 | "tabwriter", 1611 | "test-strategy", 1612 | "toml", 1613 | "tvix-eval-builtin-macros", 1614 | "xml-rs", 1615 | ] 1616 | 1617 | [[package]] 1618 | name = "tvix-eval-builtin-macros" 1619 | version = "0.0.1" 1620 | source = "git+https://github.com/tvlfyi/tvix.git#e1367fc0c65ecaa5d94f8e82c46cd6b104d0ee82" 1621 | dependencies = [ 1622 | "proc-macro2", 1623 | "quote", 1624 | "syn 1.0.109", 1625 | ] 1626 | 1627 | [[package]] 1628 | name = "tvix-serde" 1629 | version = "0.1.0" 1630 | source = "git+https://github.com/tvlfyi/tvix.git#e1367fc0c65ecaa5d94f8e82c46cd6b104d0ee82" 1631 | dependencies = [ 1632 | "serde", 1633 | "tvix-eval", 1634 | ] 1635 | 1636 | [[package]] 1637 | name = "unarray" 1638 | version = "0.1.4" 1639 | source = "registry+https://github.com/rust-lang/crates.io-index" 1640 | checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" 1641 | 1642 | [[package]] 1643 | name = "unicode-bidi" 1644 | version = "0.3.14" 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" 1646 | checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" 1647 | 1648 | [[package]] 1649 | name = "unicode-ident" 1650 | version = "1.0.12" 1651 | source = "registry+https://github.com/rust-lang/crates.io-index" 1652 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1653 | 1654 | [[package]] 1655 | name = "unicode-normalization" 1656 | version = "0.1.22" 1657 | source = "registry+https://github.com/rust-lang/crates.io-index" 1658 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1659 | dependencies = [ 1660 | "tinyvec", 1661 | ] 1662 | 1663 | [[package]] 1664 | name = "unicode-width" 1665 | version = "0.1.11" 1666 | source = "registry+https://github.com/rust-lang/crates.io-index" 1667 | checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" 1668 | 1669 | [[package]] 1670 | name = "url" 1671 | version = "2.5.0" 1672 | source = "registry+https://github.com/rust-lang/crates.io-index" 1673 | checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" 1674 | dependencies = [ 1675 | "form_urlencoded", 1676 | "idna", 1677 | "percent-encoding", 1678 | ] 1679 | 1680 | [[package]] 1681 | name = "utf8parse" 1682 | version = "0.2.1" 1683 | source = "registry+https://github.com/rust-lang/crates.io-index" 1684 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 1685 | 1686 | [[package]] 1687 | name = "vcpkg" 1688 | version = "0.2.15" 1689 | source = "registry+https://github.com/rust-lang/crates.io-index" 1690 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1691 | 1692 | [[package]] 1693 | name = "version_check" 1694 | version = "0.9.4" 1695 | source = "registry+https://github.com/rust-lang/crates.io-index" 1696 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1697 | 1698 | [[package]] 1699 | name = "wait-timeout" 1700 | version = "0.2.0" 1701 | source = "registry+https://github.com/rust-lang/crates.io-index" 1702 | checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" 1703 | dependencies = [ 1704 | "libc", 1705 | ] 1706 | 1707 | [[package]] 1708 | name = "want" 1709 | version = "0.3.1" 1710 | source = "registry+https://github.com/rust-lang/crates.io-index" 1711 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1712 | dependencies = [ 1713 | "try-lock", 1714 | ] 1715 | 1716 | [[package]] 1717 | name = "wasi" 1718 | version = "0.11.0+wasi-snapshot-preview1" 1719 | source = "registry+https://github.com/rust-lang/crates.io-index" 1720 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1721 | 1722 | [[package]] 1723 | name = "wasm-bindgen" 1724 | version = "0.2.89" 1725 | source = "registry+https://github.com/rust-lang/crates.io-index" 1726 | checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" 1727 | dependencies = [ 1728 | "cfg-if", 1729 | "wasm-bindgen-macro", 1730 | ] 1731 | 1732 | [[package]] 1733 | name = "wasm-bindgen-backend" 1734 | version = "0.2.89" 1735 | source = "registry+https://github.com/rust-lang/crates.io-index" 1736 | checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" 1737 | dependencies = [ 1738 | "bumpalo", 1739 | "log", 1740 | "once_cell", 1741 | "proc-macro2", 1742 | "quote", 1743 | "syn 2.0.48", 1744 | "wasm-bindgen-shared", 1745 | ] 1746 | 1747 | [[package]] 1748 | name = "wasm-bindgen-futures" 1749 | version = "0.4.39" 1750 | source = "registry+https://github.com/rust-lang/crates.io-index" 1751 | checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" 1752 | dependencies = [ 1753 | "cfg-if", 1754 | "js-sys", 1755 | "wasm-bindgen", 1756 | "web-sys", 1757 | ] 1758 | 1759 | [[package]] 1760 | name = "wasm-bindgen-macro" 1761 | version = "0.2.89" 1762 | source = "registry+https://github.com/rust-lang/crates.io-index" 1763 | checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" 1764 | dependencies = [ 1765 | "quote", 1766 | "wasm-bindgen-macro-support", 1767 | ] 1768 | 1769 | [[package]] 1770 | name = "wasm-bindgen-macro-support" 1771 | version = "0.2.89" 1772 | source = "registry+https://github.com/rust-lang/crates.io-index" 1773 | checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" 1774 | dependencies = [ 1775 | "proc-macro2", 1776 | "quote", 1777 | "syn 2.0.48", 1778 | "wasm-bindgen-backend", 1779 | "wasm-bindgen-shared", 1780 | ] 1781 | 1782 | [[package]] 1783 | name = "wasm-bindgen-shared" 1784 | version = "0.2.89" 1785 | source = "registry+https://github.com/rust-lang/crates.io-index" 1786 | checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" 1787 | 1788 | [[package]] 1789 | name = "web-sys" 1790 | version = "0.3.66" 1791 | source = "registry+https://github.com/rust-lang/crates.io-index" 1792 | checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" 1793 | dependencies = [ 1794 | "js-sys", 1795 | "wasm-bindgen", 1796 | ] 1797 | 1798 | [[package]] 1799 | name = "winapi" 1800 | version = "0.3.9" 1801 | source = "registry+https://github.com/rust-lang/crates.io-index" 1802 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1803 | dependencies = [ 1804 | "winapi-i686-pc-windows-gnu", 1805 | "winapi-x86_64-pc-windows-gnu", 1806 | ] 1807 | 1808 | [[package]] 1809 | name = "winapi-i686-pc-windows-gnu" 1810 | version = "0.4.0" 1811 | source = "registry+https://github.com/rust-lang/crates.io-index" 1812 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1813 | 1814 | [[package]] 1815 | name = "winapi-util" 1816 | version = "0.1.6" 1817 | source = "registry+https://github.com/rust-lang/crates.io-index" 1818 | checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" 1819 | dependencies = [ 1820 | "winapi", 1821 | ] 1822 | 1823 | [[package]] 1824 | name = "winapi-x86_64-pc-windows-gnu" 1825 | version = "0.4.0" 1826 | source = "registry+https://github.com/rust-lang/crates.io-index" 1827 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1828 | 1829 | [[package]] 1830 | name = "windows-sys" 1831 | version = "0.48.0" 1832 | source = "registry+https://github.com/rust-lang/crates.io-index" 1833 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1834 | dependencies = [ 1835 | "windows-targets 0.48.5", 1836 | ] 1837 | 1838 | [[package]] 1839 | name = "windows-sys" 1840 | version = "0.52.0" 1841 | source = "registry+https://github.com/rust-lang/crates.io-index" 1842 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1843 | dependencies = [ 1844 | "windows-targets 0.52.0", 1845 | ] 1846 | 1847 | [[package]] 1848 | name = "windows-targets" 1849 | version = "0.48.5" 1850 | source = "registry+https://github.com/rust-lang/crates.io-index" 1851 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1852 | dependencies = [ 1853 | "windows_aarch64_gnullvm 0.48.5", 1854 | "windows_aarch64_msvc 0.48.5", 1855 | "windows_i686_gnu 0.48.5", 1856 | "windows_i686_msvc 0.48.5", 1857 | "windows_x86_64_gnu 0.48.5", 1858 | "windows_x86_64_gnullvm 0.48.5", 1859 | "windows_x86_64_msvc 0.48.5", 1860 | ] 1861 | 1862 | [[package]] 1863 | name = "windows-targets" 1864 | version = "0.52.0" 1865 | source = "registry+https://github.com/rust-lang/crates.io-index" 1866 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 1867 | dependencies = [ 1868 | "windows_aarch64_gnullvm 0.52.0", 1869 | "windows_aarch64_msvc 0.52.0", 1870 | "windows_i686_gnu 0.52.0", 1871 | "windows_i686_msvc 0.52.0", 1872 | "windows_x86_64_gnu 0.52.0", 1873 | "windows_x86_64_gnullvm 0.52.0", 1874 | "windows_x86_64_msvc 0.52.0", 1875 | ] 1876 | 1877 | [[package]] 1878 | name = "windows_aarch64_gnullvm" 1879 | version = "0.48.5" 1880 | source = "registry+https://github.com/rust-lang/crates.io-index" 1881 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1882 | 1883 | [[package]] 1884 | name = "windows_aarch64_gnullvm" 1885 | version = "0.52.0" 1886 | source = "registry+https://github.com/rust-lang/crates.io-index" 1887 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" 1888 | 1889 | [[package]] 1890 | name = "windows_aarch64_msvc" 1891 | version = "0.48.5" 1892 | source = "registry+https://github.com/rust-lang/crates.io-index" 1893 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1894 | 1895 | [[package]] 1896 | name = "windows_aarch64_msvc" 1897 | version = "0.52.0" 1898 | source = "registry+https://github.com/rust-lang/crates.io-index" 1899 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" 1900 | 1901 | [[package]] 1902 | name = "windows_i686_gnu" 1903 | version = "0.48.5" 1904 | source = "registry+https://github.com/rust-lang/crates.io-index" 1905 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1906 | 1907 | [[package]] 1908 | name = "windows_i686_gnu" 1909 | version = "0.52.0" 1910 | source = "registry+https://github.com/rust-lang/crates.io-index" 1911 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" 1912 | 1913 | [[package]] 1914 | name = "windows_i686_msvc" 1915 | version = "0.48.5" 1916 | source = "registry+https://github.com/rust-lang/crates.io-index" 1917 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1918 | 1919 | [[package]] 1920 | name = "windows_i686_msvc" 1921 | version = "0.52.0" 1922 | source = "registry+https://github.com/rust-lang/crates.io-index" 1923 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" 1924 | 1925 | [[package]] 1926 | name = "windows_x86_64_gnu" 1927 | version = "0.48.5" 1928 | source = "registry+https://github.com/rust-lang/crates.io-index" 1929 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1930 | 1931 | [[package]] 1932 | name = "windows_x86_64_gnu" 1933 | version = "0.52.0" 1934 | source = "registry+https://github.com/rust-lang/crates.io-index" 1935 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" 1936 | 1937 | [[package]] 1938 | name = "windows_x86_64_gnullvm" 1939 | version = "0.48.5" 1940 | source = "registry+https://github.com/rust-lang/crates.io-index" 1941 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1942 | 1943 | [[package]] 1944 | name = "windows_x86_64_gnullvm" 1945 | version = "0.52.0" 1946 | source = "registry+https://github.com/rust-lang/crates.io-index" 1947 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" 1948 | 1949 | [[package]] 1950 | name = "windows_x86_64_msvc" 1951 | version = "0.48.5" 1952 | source = "registry+https://github.com/rust-lang/crates.io-index" 1953 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1954 | 1955 | [[package]] 1956 | name = "windows_x86_64_msvc" 1957 | version = "0.52.0" 1958 | source = "registry+https://github.com/rust-lang/crates.io-index" 1959 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" 1960 | 1961 | [[package]] 1962 | name = "winreg" 1963 | version = "0.50.0" 1964 | source = "registry+https://github.com/rust-lang/crates.io-index" 1965 | checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" 1966 | dependencies = [ 1967 | "cfg-if", 1968 | "windows-sys 0.48.0", 1969 | ] 1970 | 1971 | [[package]] 1972 | name = "xml-rs" 1973 | version = "0.8.19" 1974 | source = "registry+https://github.com/rust-lang/crates.io-index" 1975 | checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" 1976 | -------------------------------------------------------------------------------- /cli/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nixbox" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | clap = { version = "4.4.12", features = ["derive"] } 8 | reqwest = { version = "0.11", features = ["blocking", "json"] } 9 | serde = { version = "1.0.195", features = ["derive"] } 10 | serde_json = "1.0.111" 11 | tokio = { version = "1.35.1", features = ["full"] } 12 | tvix-serde = { git = "https://github.com/tvlfyi/tvix.git", version = "0.1.0" } 13 | -------------------------------------------------------------------------------- /cli/exportips.json: -------------------------------------------------------------------------------- 1 | {"count":75,"next":"https://demo.netbox.dev/api/ipam/ip-addresses/?limit=50&offset=50","previous":null,"results":[{"address":"1.2.3.4/32","assigned_object":{"_occupied":false,"cable":null,"device":{"display":"ABC-DEF-DCN-ASW-001","id":107,"name":"ABC-DEF-DCN-ASW-001","url":"https://demo.netbox.dev/api/dcim/devices/107/"},"display":"Loopback0","id":1631,"name":"Loopback0","url":"https://demo.netbox.dev/api/dcim/interfaces/1631/"},"assigned_object_id":1631,"assigned_object_type":"dcim.interface","comments":"","created":"2024-01-11T16:04:43.402207Z","custom_fields":{},"description":"","display":"1.2.3.4/32","dns_name":"","family":{"label":"IPv4","value":4},"id":259,"last_updated":"2024-01-11T16:04:43.402258Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/259/","vrf":null},{"address":"8.8.8.8/32","assigned_object":{"_occupied":false,"cable":null,"device":{"display":"GRE_INTR1","id":113,"name":"GRE_INTR1","url":"https://demo.netbox.dev/api/dcim/devices/113/"},"display":"Tunnel5-ext","id":1705,"name":"Tunnel5-ext","url":"https://demo.netbox.dev/api/dcim/interfaces/1705/"},"assigned_object_id":1705,"assigned_object_type":"dcim.interface","comments":"","created":"2024-01-11T16:17:21.099319Z","custom_fields":{},"description":"","display":"8.8.8.8/32","dns_name":"","family":{"label":"IPv4","value":4},"id":265,"last_updated":"2024-01-11T16:17:21.099415Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/265/","vrf":null},{"address":"10.1.1.25/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T21:46:59.409738Z","custom_fields":{},"description":"","display":"10.1.1.25/24","dns_name":"","family":{"label":"IPv4","value":4},"id":276,"last_updated":"2024-01-11T21:46:59.409783Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/276/","vrf":null},{"address":"10.11.65.34/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.283205Z","custom_fields":{},"description":"","display":"10.11.65.34/24","dns_name":"","family":{"label":"IPv4","value":4},"id":209,"last_updated":"2024-01-11T12:58:46.283255Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/209/","vrf":null},{"address":"10.11.74.21/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.676663Z","custom_fields":{},"description":"","display":"10.11.74.21/24","dns_name":"","family":{"label":"IPv4","value":4},"id":216,"last_updated":"2024-01-11T12:58:46.676710Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/216/","vrf":null},{"address":"10.11.77.45/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.182574Z","custom_fields":{},"description":"","display":"10.11.77.45/24","dns_name":"","family":{"label":"IPv4","value":4},"id":242,"last_updated":"2024-01-11T12:58:48.182614Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/242/","vrf":null},{"address":"10.11.82.55/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.704907Z","custom_fields":{},"description":"","display":"10.11.82.55/24","dns_name":"","family":{"label":"IPv4","value":4},"id":252,"last_updated":"2024-01-11T12:58:48.704971Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/252/","vrf":null},{"address":"10.11.85.29/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.010684Z","custom_fields":{},"description":"","display":"10.11.85.29/24","dns_name":"","family":{"label":"IPv4","value":4},"id":222,"last_updated":"2024-01-11T12:58:47.010736Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/222/","vrf":null},{"address":"10.11.92.200/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.856385Z","custom_fields":{},"description":"","display":"10.11.92.200/24","dns_name":"","family":{"label":"IPv4","value":4},"id":202,"last_updated":"2024-01-11T12:58:45.856422Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/202/","vrf":null},{"address":"10.11.96.84/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.596542Z","custom_fields":{},"description":"","display":"10.11.96.84/24","dns_name":"","family":{"label":"IPv4","value":4},"id":232,"last_updated":"2024-01-11T12:58:47.596595Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/232/","vrf":null},{"address":"10.12.16.89/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.726986Z","custom_fields":{},"description":"","display":"10.12.16.89/24","dns_name":"","family":{"label":"IPv4","value":4},"id":217,"last_updated":"2024-01-11T12:58:46.727021Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/217/","vrf":null},{"address":"10.12.20.46/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.239618Z","custom_fields":{},"description":"","display":"10.12.20.46/24","dns_name":"","family":{"label":"IPv4","value":4},"id":243,"last_updated":"2024-01-11T12:58:48.239664Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/243/","vrf":null},{"address":"10.12.31.56/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.757551Z","custom_fields":{},"description":"","display":"10.12.31.56/24","dns_name":"","family":{"label":"IPv4","value":4},"id":253,"last_updated":"2024-01-11T12:58:48.757604Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/253/","vrf":null},{"address":"10.12.38.95/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.661525Z","custom_fields":{},"description":"","display":"10.12.38.95/24","dns_name":"","family":{"label":"IPv4","value":4},"id":233,"last_updated":"2024-01-11T12:58:47.661571Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/233/","vrf":null},{"address":"10.12.44.110/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.065498Z","custom_fields":{},"description":"","display":"10.12.44.110/24","dns_name":"","family":{"label":"IPv4","value":4},"id":223,"last_updated":"2024-01-11T12:58:47.065566Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/223/","vrf":null},{"address":"10.12.67.34/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.655999Z","custom_fields":{},"description":"","display":"10.12.67.34/24","dns_name":"","family":{"label":"IPv4","value":4},"id":199,"last_updated":"2024-01-11T12:58:45.656032Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/199/","vrf":null},{"address":"10.12.81.90/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.403916Z","custom_fields":{},"description":"","display":"10.12.81.90/24","dns_name":"","family":{"label":"IPv4","value":4},"id":211,"last_updated":"2024-01-11T12:58:46.403961Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/211/","vrf":null},{"address":"10.13.86.50/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.446475Z","custom_fields":{},"description":"","display":"10.13.86.50/24","dns_name":"","family":{"label":"IPv4","value":4},"id":247,"last_updated":"2024-01-11T12:58:48.446519Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/247/","vrf":null},{"address":"10.13.88.36/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.294164Z","custom_fields":{},"description":"","display":"10.13.88.36/24","dns_name":"","family":{"label":"IPv4","value":4},"id":227,"last_updated":"2024-01-11T12:58:47.294215Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/227/","vrf":null},{"address":"10.13.91.40/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.912350Z","custom_fields":{},"description":"","display":"10.13.91.40/24","dns_name":"","family":{"label":"IPv4","value":4},"id":237,"last_updated":"2024-01-11T12:58:47.912393Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/237/","vrf":null},{"address":"10.13.93.60/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.961921Z","custom_fields":{},"description":"","display":"10.13.93.60/24","dns_name":"","family":{"label":"IPv4","value":4},"id":257,"last_updated":"2024-01-11T12:58:48.961961Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/257/","vrf":null},{"address":"10.13.99.211/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.985211Z","custom_fields":{},"description":"","display":"10.13.99.211/24","dns_name":"","family":{"label":"IPv4","value":4},"id":204,"last_updated":"2024-01-11T12:58:45.985264Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/204/","vrf":null},{"address":"10.31.47.103/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.524974Z","custom_fields":{},"description":"","display":"10.31.47.103/24","dns_name":"","family":{"label":"IPv4","value":4},"id":197,"last_updated":"2024-01-11T12:58:45.525041Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/197/","vrf":null},{"address":"10.31.51.73/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.529428Z","custom_fields":{},"description":"","display":"10.31.51.73/24","dns_name":"","family":{"label":"IPv4","value":4},"id":231,"last_updated":"2024-01-11T12:58:47.529461Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/231/","vrf":null},{"address":"10.31.62.18/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.951659Z","custom_fields":{},"description":"","display":"10.31.62.18/24","dns_name":"","family":{"label":"IPv4","value":4},"id":221,"last_updated":"2024-01-11T12:58:46.951720Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/221/","vrf":null},{"address":"10.31.68.44/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.126682Z","custom_fields":{},"description":"","display":"10.31.68.44/24","dns_name":"","family":{"label":"IPv4","value":4},"id":241,"last_updated":"2024-01-11T12:58:48.126721Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/241/","vrf":null},{"address":"10.31.73.54/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.650156Z","custom_fields":{},"description":"","display":"10.31.73.54/24","dns_name":"","family":{"label":"IPv4","value":4},"id":251,"last_updated":"2024-01-11T12:58:48.650190Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/251/","vrf":null},{"address":"10.31.83.47/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.625972Z","custom_fields":{},"description":"","display":"10.31.83.47/24","dns_name":"","family":{"label":"IPv4","value":4},"id":215,"last_updated":"2024-01-11T12:58:46.626008Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/215/","vrf":null},{"address":"10.31.94.103/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.235191Z","custom_fields":{},"description":"","display":"10.31.94.103/24","dns_name":"","family":{"label":"IPv4","value":4},"id":208,"last_updated":"2024-01-11T12:58:46.235228Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/208/","vrf":null},{"address":"10.32.53.49/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.388946Z","custom_fields":{},"description":"","display":"10.32.53.49/24","dns_name":"","family":{"label":"IPv4","value":4},"id":246,"last_updated":"2024-01-11T12:58:48.388985Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/246/","vrf":null},{"address":"10.32.56.59/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.909300Z","custom_fields":{},"description":"","display":"10.32.56.59/24","dns_name":"","family":{"label":"IPv4","value":4},"id":256,"last_updated":"2024-01-11T12:58:48.909344Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/256/","vrf":null},{"address":"10.32.57.91/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.238080Z","custom_fields":{},"description":"","display":"10.32.57.91/24","dns_name":"","family":{"label":"IPv4","value":4},"id":226,"last_updated":"2024-01-11T12:58:47.238134Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/226/","vrf":null},{"address":"10.32.58.145/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.919883Z","custom_fields":{},"description":"","display":"10.32.58.145/24","dns_name":"","family":{"label":"IPv4","value":4},"id":203,"last_updated":"2024-01-11T12:58:45.919972Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/203/","vrf":null},{"address":"10.32.60.39/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.849223Z","custom_fields":{},"description":"","display":"10.32.60.39/24","dns_name":"","family":{"label":"IPv4","value":4},"id":236,"last_updated":"2024-01-11T12:58:47.849289Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/236/","vrf":null},{"address":"10.33.14.53/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.606525Z","custom_fields":{},"description":"","display":"10.33.14.53/24","dns_name":"","family":{"label":"IPv4","value":4},"id":250,"last_updated":"2024-01-11T12:58:48.606573Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/250/","vrf":null},{"address":"10.33.18.29/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.723484Z","custom_fields":{},"description":"","display":"10.33.18.29/24","dns_name":"","family":{"label":"IPv4","value":4},"id":200,"last_updated":"2024-01-11T12:58:45.723540Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/200/","vrf":null},{"address":"10.33.25.67/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.904276Z","custom_fields":{},"description":"","display":"10.33.25.67/24","dns_name":"","family":{"label":"IPv4","value":4},"id":220,"last_updated":"2024-01-11T12:58:46.904332Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/220/","vrf":null},{"address":"10.33.35.43/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.078824Z","custom_fields":{},"description":"","display":"10.33.35.43/24","dns_name":"","family":{"label":"IPv4","value":4},"id":240,"last_updated":"2024-01-11T12:58:48.078884Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/240/","vrf":null},{"address":"10.33.46.52/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.470395Z","custom_fields":{},"description":"","display":"10.33.46.52/24","dns_name":"","family":{"label":"IPv4","value":4},"id":230,"last_updated":"2024-01-11T12:58:47.470432Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/230/","vrf":null},{"address":"10.33.59.33/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.569912Z","custom_fields":{},"description":"","display":"10.33.59.33/24","dns_name":"","family":{"label":"IPv4","value":4},"id":214,"last_updated":"2024-01-11T12:58:46.569961Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/214/","vrf":null},{"address":"10.33.78.22/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.175599Z","custom_fields":{},"description":"","display":"10.33.78.22/24","dns_name":"","family":{"label":"IPv4","value":4},"id":207,"last_updated":"2024-01-11T12:58:46.175648Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/207/","vrf":null},{"address":"10.34.22.89/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:45.791517Z","custom_fields":{},"description":"","display":"10.34.22.89/24","dns_name":"","family":{"label":"IPv4","value":4},"id":201,"last_updated":"2024-01-11T12:58:45.791594Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/201/","vrf":null},{"address":"10.34.24.48/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.339330Z","custom_fields":{},"description":"","display":"10.34.24.48/24","dns_name":"","family":{"label":"IPv4","value":4},"id":245,"last_updated":"2024-01-11T12:58:48.339376Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/245/","vrf":null},{"address":"10.34.66.78/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.178449Z","custom_fields":{},"description":"","display":"10.34.66.78/24","dns_name":"","family":{"label":"IPv4","value":4},"id":225,"last_updated":"2024-01-11T12:58:47.178494Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/225/","vrf":null},{"address":"10.34.69.58/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.852397Z","custom_fields":{},"description":"","display":"10.34.69.58/24","dns_name":"","family":{"label":"IPv4","value":4},"id":255,"last_updated":"2024-01-11T12:58:48.852441Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/255/","vrf":null},{"address":"10.34.75.58/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.455848Z","custom_fields":{},"description":"","display":"10.34.75.58/24","dns_name":"","family":{"label":"IPv4","value":4},"id":212,"last_updated":"2024-01-11T12:58:46.455890Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/212/","vrf":null},{"address":"10.34.79.28/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.788702Z","custom_fields":{},"description":"","display":"10.34.79.28/24","dns_name":"","family":{"label":"IPv4","value":4},"id":235,"last_updated":"2024-01-11T12:58:47.788758Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/235/","vrf":null},{"address":"10.35.12.47/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:46.109512Z","custom_fields":{},"description":"","display":"10.35.12.47/24","dns_name":"","family":{"label":"IPv4","value":4},"id":206,"last_updated":"2024-01-11T12:58:46.109558Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Reserved","value":"reserved"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/206/","vrf":null},{"address":"10.35.23.109/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:47.419117Z","custom_fields":{},"description":"","display":"10.35.23.109/24","dns_name":"","family":{"label":"IPv4","value":4},"id":229,"last_updated":"2024-01-11T12:58:47.419165Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/229/","vrf":null},{"address":"10.35.48.42/24","assigned_object":null,"assigned_object_id":null,"assigned_object_type":null,"comments":"","created":"2024-01-11T12:58:48.025431Z","custom_fields":{},"description":"","display":"10.35.48.42/24","dns_name":"","family":{"label":"IPv4","value":4},"id":239,"last_updated":"2024-01-11T12:58:48.025476Z","nat_inside":null,"nat_outside":[],"role":null,"status":{"label":"Active","value":"active"},"tags":[],"tenant":null,"url":"https://demo.netbox.dev/api/ipam/ip-addresses/239/","vrf":null}]} -------------------------------------------------------------------------------- /cli/src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::{Parser, Subcommand}; 2 | use serde::{Deserialize, Serialize}; 3 | // use tvix_serde; 4 | use std::error; 5 | use std::fs; 6 | use std::io::Write; 7 | use std::net::IpAddr; 8 | use std::{env, path::PathBuf}; 9 | 10 | #[derive(Parser, Debug)] 11 | #[clap(version)] 12 | struct Args { 13 | #[command(subcommand)] 14 | cmd: SubCommands, 15 | } 16 | 17 | #[derive(Subcommand, Debug)] 18 | enum SubCommands { 19 | Add { 20 | #[clap(long, short, action)] 21 | ips: bool, 22 | }, 23 | Export { 24 | #[clap(short, long)] 25 | ips: bool, 26 | 27 | #[clap(short, long)] 28 | location: Option, 29 | }, 30 | } 31 | 32 | #[derive(Debug, Serialize, Deserialize)] 33 | struct IpAddresses { 34 | address: IpAddr, // TODO(Janik): make it use CIDR 35 | status: String, // TODO(Janik): enum actual netbox values 36 | dns_name: String, 37 | tags: Vec, 38 | } 39 | 40 | fn netbox_api_request(url: String) -> Result> { 41 | // TODO(Janik): throw a error if var is unset and do http status code checks for client.get 42 | let token = env::var("NIXBOX_NETBOX_TOKEN")?; 43 | let client = reqwest::blocking::Client::new(); 44 | 45 | // We can't use the bearer auth method because netbox doesn't comply with the standards. 46 | let resp = client 47 | .get(url) 48 | .header("Authorization", "Token ".to_owned() + &token) 49 | .send()?; 50 | let json = resp.json::()?; 51 | Ok(json.to_string()) 52 | } 53 | 54 | #[derive(Serialize, Deserialize, Debug)] 55 | struct Nix { 56 | a: String, 57 | b: u32, 58 | } 59 | 60 | // this is currently stuck on https://cl.tvl.fyi/c/depot/+/10581 61 | // because we need import functionality to pull in and eval the users config 62 | // the code here is just a filler example to make it compile happily 63 | // fn get_current_config() -> Result> { 64 | // let deserialized: Result> = Ok(tvix_serde::from_str::("lib.attrsets.recursiveUpdate { a = \"coding with tvix!\"; } { b = 231; }")?); 65 | // deserialized 66 | // } 67 | 68 | fn add(_ips: bool) -> Result<(), Box> { 69 | // if ips {} 70 | Ok(()) 71 | } 72 | 73 | fn export(ips: bool, location: Option) -> Result<(), Box> { 74 | let location = location.unwrap_or_else(|| PathBuf::from("/tmp/nixbox_export")); 75 | fs::create_dir_all(location.clone())?; 76 | if ips { 77 | let mut ips_file = fs::File::create(location.to_str().unwrap().to_owned() + "ips.json")?; 78 | let _ = ips_file.write_all( 79 | (netbox_api_request(String::from( 80 | "https://demo.netbox.dev/api/ipam/ip-addresses", 81 | ))?) 82 | .as_bytes(), 83 | ); 84 | } 85 | Ok(()) 86 | } 87 | 88 | #[tokio::main] 89 | async fn main() -> Result<(), Box> { 90 | let args = Args::parse(); 91 | let _ = match args.cmd { 92 | SubCommands::Add { ips } => add(ips), 93 | SubCommands::Export { ips, location } => export(ips, location), 94 | }; 95 | Ok(()) 96 | } 97 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | todo - building blocks can mostly be copied from nixos-dns. 2 | -------------------------------------------------------------------------------- /example/ipam/devices.json: -------------------------------------------------------------------------------- 1 | { 2 | "host1.example.com": { 3 | "interfaces": [ 4 | { 5 | "name": "eth0", 6 | "type": "ethernet", 7 | "speed": 1 8 | } 9 | ], 10 | "location": {} 11 | "deviceType": "server", 12 | "rack-hight": 2, 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /example/ipam/domains.json: -------------------------------------------------------------------------------- 1 | { 2 | "example.com": { 3 | }, 4 | "example.org": { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ipam/ip-addresses.json: -------------------------------------------------------------------------------- 1 | { 2 | "198.51.100.2/24": { 3 | "status": "active", 4 | "dns_name": "host1.example.com" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/nixbox.nix: -------------------------------------------------------------------------------- 1 | { 2 | ipam = { 3 | data = import ./ipam; 4 | nixosConfigurations = { }; 5 | }; 6 | netbox = { 7 | domain = "https://demo.netbox.dev"; 8 | token-var = ""; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "crane": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1707685877, 11 | "narHash": "sha256-XoXRS+5whotelr1rHiZle5t5hDg9kpguS5yk8c8qzOc=", 12 | "owner": "ipetkov", 13 | "repo": "crane", 14 | "rev": "2c653e4478476a52c6aa3ac0495e4dea7449ea0e", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "ipetkov", 19 | "repo": "crane", 20 | "type": "github" 21 | } 22 | }, 23 | "flake-compat": { 24 | "flake": false, 25 | "locked": { 26 | "lastModified": 1696426674, 27 | "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", 28 | "owner": "edolstra", 29 | "repo": "flake-compat", 30 | "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", 31 | "type": "github" 32 | }, 33 | "original": { 34 | "owner": "edolstra", 35 | "repo": "flake-compat", 36 | "type": "github" 37 | } 38 | }, 39 | "flake-utils": { 40 | "inputs": { 41 | "systems": "systems" 42 | }, 43 | "locked": { 44 | "lastModified": 1705309234, 45 | "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", 46 | "owner": "numtide", 47 | "repo": "flake-utils", 48 | "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", 49 | "type": "github" 50 | }, 51 | "original": { 52 | "owner": "numtide", 53 | "repo": "flake-utils", 54 | "type": "github" 55 | } 56 | }, 57 | "nixpkgs": { 58 | "locked": { 59 | "lastModified": 1707956935, 60 | "narHash": "sha256-ZL2TrjVsiFNKOYwYQozpbvQSwvtV/3Me7Zwhmdsfyu4=", 61 | "owner": "NixOS", 62 | "repo": "nixpkgs", 63 | "rev": "a4d4fe8c5002202493e87ec8dbc91335ff55552c", 64 | "type": "github" 65 | }, 66 | "original": { 67 | "owner": "NixOS", 68 | "ref": "nixos-unstable", 69 | "repo": "nixpkgs", 70 | "type": "github" 71 | } 72 | }, 73 | "root": { 74 | "inputs": { 75 | "crane": "crane", 76 | "flake-compat": "flake-compat", 77 | "flake-utils": "flake-utils", 78 | "nixpkgs": "nixpkgs" 79 | } 80 | }, 81 | "systems": { 82 | "locked": { 83 | "lastModified": 1681028828, 84 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 85 | "owner": "nix-systems", 86 | "repo": "default", 87 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 88 | "type": "github" 89 | }, 90 | "original": { 91 | "owner": "nix-systems", 92 | "repo": "default", 93 | "type": "github" 94 | } 95 | } 96 | }, 97 | "root": "root", 98 | "version": 7 99 | } 100 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "A NixOS IPAM implentation hoping to integrate with netbox"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 6 | flake-compat.url = "github:edolstra/flake-compat"; 7 | flake-compat.flake = false; 8 | flake-utils.url = "github:numtide/flake-utils"; 9 | 10 | crane.url = "github:ipetkov/crane"; 11 | crane.inputs.nixpkgs.follows = "nixpkgs"; 12 | }; 13 | 14 | outputs = { self, nixpkgs, flake-compat, flake-utils, crane }: 15 | (flake-utils.lib.eachDefaultSystem (system: 16 | let 17 | pkgs = nixpkgs.legacyPackages.${system}; 18 | craneLib = crane.lib.${system}; 19 | 20 | # Common derivation arguments used for all builds 21 | cliCommonArgs = { 22 | src = craneLib.cleanCargoSource (craneLib.path ./cli); 23 | strictDeps = true; 24 | 25 | # Needed to get openssl-sys to use pkg-config. 26 | 27 | OPENSSL_NO_VENDOR = 1; 28 | 29 | buildInputs = with pkgs; [ 30 | openssl 31 | ]; 32 | 33 | nativeBuildInputs = with pkgs; [ 34 | pkg-config 35 | ]; 36 | }; 37 | cliCargoArtifacts = craneLib.buildDepsOnly (cliCommonArgs // { 38 | pname = "nixbox-cli-deps"; 39 | }); 40 | cliClippy = craneLib.cargoClippy (cliCommonArgs // { 41 | cargoArtifacts = cliCargoArtifacts; 42 | cargoClippyExtraArgs = "--all-targets -- --deny warnings"; 43 | }); 44 | 45 | cliCrate = craneLib.buildPackage (cliCommonArgs // { 46 | cargoArtifacts = cliCargoArtifacts; 47 | }); 48 | 49 | cliCoverage = craneLib.cargoTarpaulin (cliCommonArgs // { 50 | cargoArtifacts = cliCargoArtifacts; 51 | }); 52 | in 53 | { 54 | packages = 55 | { 56 | default = cliCrate; 57 | cli = cliCrate; 58 | dataSourceDemo = (import ./utils/builder.nix { inherit (nixpkgs) lib; pkgs = nixpkgs.legacyPackages.${system}; }).dataSource { }; 59 | }; 60 | formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt 61 | ; 62 | devShells = { 63 | default = craneLib.devShell { 64 | checks = self.checks.${system}; 65 | inputsFrom = [ 66 | cliCrate 67 | ]; 68 | packages = with pkgs; [ 69 | nixpkgs-fmt 70 | nix-unit 71 | nixdoc 72 | statix 73 | ]; 74 | }; 75 | }; 76 | checks = { 77 | inherit 78 | cliCrate 79 | cliClippy 80 | # cliCoverage // not yet used 81 | ; 82 | }; 83 | })) // { 84 | tests = nixpkgs.lib.mapAttrs (name: v: import "${./utils}/tests/${name}.nix" { inherit self; inherit (nixpkgs) lib; inherit (self) utils; }) (builtins.removeAttrs self.utils [ "__unfix__" "extend" "generate" ]); 85 | utils = import ./utils { inherit (nixpkgs) lib; }; 86 | nixosModules = rec { 87 | nixbox = import ./modules/nixbox.nix { inherit (self) utils; }; 88 | default = nixbox; 89 | }; 90 | }; 91 | } 92 | -------------------------------------------------------------------------------- /modules/common.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: { 2 | managedByNetbox = lib.mkOption { 3 | default = false; 4 | descripton = lib.mdDoc '' 5 | ''; 6 | type = lib.types.bool; 7 | }; 8 | comments = lib.mkOption { 9 | default = null; 10 | description = lib.mdDoc '' 11 | ''; 12 | type = lib.types.str; 13 | }; 14 | description = lib.mkOption { 15 | default = null; 16 | description = lib.mdDoc '' 17 | ''; 18 | type = lib.types.str; 19 | }; 20 | tags = lib.mkOption { 21 | default = [ ]; 22 | description = lib.mdDoc '' 23 | ''; 24 | type = with lib.types; listOf str; 25 | example = [ "wan" ]; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /modules/devices.nix: -------------------------------------------------------------------------------- 1 | { utils, lib }: 2 | { } 3 | -------------------------------------------------------------------------------- /modules/domains.nix: -------------------------------------------------------------------------------- 1 | { utils, lib }: 2 | { } 3 | -------------------------------------------------------------------------------- /modules/interfaces.nix: -------------------------------------------------------------------------------- 1 | { utils }: { lib, ... }: { 2 | name = lib.mkOption { 3 | description = lib.mdDoc '' 4 | ''; 5 | example = "eth0"; 6 | type = lib.types.str; 7 | }; 8 | mac = lib.mkOption { 9 | default = null; 10 | description = lib.mdDoc '' 11 | ''; 12 | type = lib.types.nullOr lib.types.str; 13 | }; 14 | speed = lib.mkOption { 15 | default = 1000000; 16 | description = lib.mdDoc '' 17 | in Kbps 18 | ''; 19 | type = lib.types.int; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/ip-addresses.nix: -------------------------------------------------------------------------------- 1 | { utils, lib }: 2 | { } 3 | -------------------------------------------------------------------------------- /modules/nixbox.nix: -------------------------------------------------------------------------------- 1 | { utils }: { lib, ... }: 2 | { 3 | imports = [ 4 | ./service-template.nix 5 | ]; 6 | } 7 | -------------------------------------------------------------------------------- /modules/service-template.nix: -------------------------------------------------------------------------------- 1 | { config, lib, utils }: 2 | { 3 | options = { 4 | nixbox = { 5 | serviceTemplate = lib.types.attrsOf (lib.types.submodule { 6 | options = { 7 | name = lib.mkOption { 8 | description = '' 9 | A service or protocol name. 10 | ''; 11 | type = lib.types.str; 12 | example = "https"; 13 | }; 14 | protocol = lib.mkOption { 15 | description = '' 16 | The wire protocol on which the service runs. 17 | ''; 18 | type = lib.types.enum [ "tcp" "udp" "sctp" ]; 19 | example = "tcp"; 20 | }; 21 | ports = lib.mkOption { 22 | description = '' 23 | One or more numeric ports to which the service is bound. Multiple ports can be expressed using lists and `utils.networking.portrange`. 24 | ''; 25 | type = lib.types.listOf lib.types.int; 26 | example = [ 443 ]; 27 | }; 28 | }; 29 | }); 30 | servicePrests = { }; 31 | }; 32 | }; 33 | config = { 34 | nixbox = { }; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /modules/subnets.nix: -------------------------------------------------------------------------------- 1 | { utils }: { lib, config, ... }: { 2 | options = { 3 | subnets = with lib.types; listOf (submodule { 4 | options = (import ./common.nix { inherit lib config; }) // { 5 | address = lib.mkOption { 6 | description = lib.mdDoc '' 7 | ''; 8 | type = utils.types.ipAddressWithMask; 9 | }; 10 | defaultGateway = lib.mkOption { 11 | description = lib.mdDoc '' 12 | ''; 13 | type = utils.types.ipAddressWithMask; 14 | }; 15 | }; 16 | }); 17 | }; 18 | config = { }; 19 | } 20 | -------------------------------------------------------------------------------- /utils/builder.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: rec { 2 | dataFile = type: data: 3 | builtins.toFile type (builtins.toJSON (lib.mapAttrsToList (n: v: { ${type} = n; } // v) data)) 4 | ; 5 | dataSource = data: 6 | pkgs.linkFarm "dataFiles" ( 7 | lib.mapAttrsToList 8 | ( 9 | n: v: { 10 | name = n; 11 | path = dataFile n v; 12 | } 13 | ) 14 | { 15 | address = builtins.fromJSON (builtins.readFile ../example/ipam/ip-addresses.json); 16 | } 17 | ) 18 | ; 19 | } 20 | -------------------------------------------------------------------------------- /utils/datafile.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "family": { 4 | "value": 4, 5 | "label": "IPv4" 6 | }, 7 | "address": "172.16.0.1/24", 8 | "tenant": null, 9 | "status": "active", 10 | "dns_name": "", 11 | "description": "", 12 | "comments": "", 13 | "tags": [], 14 | "custom_fields": {}, 15 | "created": "2022-04-08T00:25:21.668000Z", 16 | "last_updated": "2022-04-08T00:25:21.668000Z" 17 | }, 18 | { 19 | "family": { 20 | "value": 4, 21 | "label": "IPv4" 22 | }, 23 | "address": "172.16.0.2/24", 24 | "tenant": null, 25 | "status": "active", 26 | "role": null, 27 | "assigned_object_type": null, 28 | "assigned_object": null, 29 | "dns_name": "", 30 | "description": "", 31 | "comments": "", 32 | "tags": [], 33 | "custom_fields": {}, 34 | "created": "2022-04-08T00:25:21.772000Z", 35 | "last_updated": "2022-04-08T00:25:21.772000Z" 36 | }, 37 | { 38 | "family": { 39 | "value": 4, 40 | "label": "IPv4" 41 | }, 42 | "address": "172.16.0.3/24", 43 | "tenant": null, 44 | "status": "active", 45 | "role": null, 46 | "assigned_object_type": null, 47 | "assigned_object": null, 48 | "dns_name": "", 49 | "description": "", 50 | "comments": "", 51 | "tags": [], 52 | "custom_fields": {}, 53 | "created": "2022-04-08T00:25:21.942000Z", 54 | "last_updated": "2022-04-08T00:25:21.942000Z" 55 | }, 56 | { 57 | "family": { 58 | "value": 4, 59 | "label": "IPv4" 60 | }, 61 | "address": "172.16.0.4/24", 62 | "tenant": null, 63 | "status": "active", 64 | "role": null, 65 | "assigned_object_type": null, 66 | "assigned_object": null, 67 | "dns_name": "", 68 | "description": "", 69 | "comments": "", 70 | "tags": [], 71 | "custom_fields": {}, 72 | "created": "2022-04-08T00:25:22.056000Z", 73 | "last_updated": "2022-04-08T00:25:22.056000Z" 74 | }, 75 | { 76 | "family": { 77 | "value": 4, 78 | "label": "IPv4" 79 | }, 80 | "address": "172.16.0.5/24", 81 | "tenant": null, 82 | "status": "active", 83 | "role": null, 84 | "assigned_object_type": null, 85 | "assigned_object": null, 86 | "dns_name": "", 87 | "description": "", 88 | "comments": "", 89 | "tags": [], 90 | "custom_fields": {}, 91 | "created": "2022-04-08T00:25:22.157000Z", 92 | "last_updated": "2022-04-08T00:25:22.157000Z" 93 | }, 94 | { 95 | "family": { 96 | "value": 4, 97 | "label": "IPv4" 98 | }, 99 | "address": "172.16.0.6/24", 100 | "tenant": null, 101 | "status": "active", 102 | "role": null, 103 | "assigned_object_type": null, 104 | "assigned_object": null, 105 | "dns_name": "", 106 | "description": "", 107 | "comments": "", 108 | "tags": [], 109 | "custom_fields": {}, 110 | "created": "2022-04-08T00:25:22.245000Z", 111 | "last_updated": "2022-04-08T00:25:22.245000Z" 112 | }, 113 | { 114 | "family": { 115 | "value": 4, 116 | "label": "IPv4" 117 | }, 118 | "address": "172.16.0.7/24", 119 | "tenant": null, 120 | "status": "active", 121 | "role": null, 122 | "assigned_object_type": null, 123 | "assigned_object": null, 124 | "dns_name": "", 125 | "description": "", 126 | "comments": "", 127 | "tags": [], 128 | "custom_fields": {}, 129 | "created": "2022-04-08T00:25:22.331000Z", 130 | "last_updated": "2022-04-08T00:25:22.331000Z" 131 | }, 132 | { 133 | "family": { 134 | "value": 4, 135 | "label": "IPv4" 136 | }, 137 | "address": "172.16.0.8/24", 138 | "tenant": null, 139 | "status": "active", 140 | "role": null, 141 | "assigned_object_type": null, 142 | "assigned_object": null, 143 | "dns_name": "", 144 | "description": "", 145 | "comments": "", 146 | "tags": [], 147 | "custom_fields": {}, 148 | "created": "2022-04-08T00:25:22.416000Z", 149 | "last_updated": "2022-04-08T00:25:22.416000Z" 150 | }, 151 | { 152 | "family": { 153 | "value": 4, 154 | "label": "IPv4" 155 | }, 156 | "address": "172.16.0.9/24", 157 | "tenant": null, 158 | "status": "active", 159 | "role": null, 160 | "assigned_object_type": null, 161 | "assigned_object": null, 162 | "dns_name": "", 163 | "description": "", 164 | "comments": "", 165 | "tags": [], 166 | "custom_fields": {}, 167 | "created": "2022-04-08T00:25:22.500000Z", 168 | "last_updated": "2022-04-08T00:25:22.500000Z" 169 | }, 170 | { 171 | "family": { 172 | "value": 4, 173 | "label": "IPv4" 174 | }, 175 | "address": "172.16.0.10/24", 176 | "tenant": null, 177 | "status": "active", 178 | "role": null, 179 | "assigned_object_type": null, 180 | "assigned_object": null, 181 | "dns_name": "", 182 | "description": "", 183 | "comments": "", 184 | "tags": [], 185 | "custom_fields": {}, 186 | "created": "2022-04-08T00:25:22.586000Z", 187 | "last_updated": "2022-04-08T00:25:22.586000Z" 188 | }, 189 | { 190 | "family": { 191 | "value": 4, 192 | "label": "IPv4" 193 | }, 194 | "address": "172.16.0.11/24", 195 | "tenant": null, 196 | "status": "active", 197 | "role": null, 198 | "assigned_object_type": null, 199 | "assigned_object": null, 200 | "dns_name": "", 201 | "description": "", 202 | "comments": "", 203 | "tags": [], 204 | "custom_fields": {}, 205 | "created": "2022-04-08T00:25:22.671000Z", 206 | "last_updated": "2022-04-08T00:25:22.671000Z" 207 | }, 208 | { 209 | "family": { 210 | "value": 4, 211 | "label": "IPv4" 212 | }, 213 | "address": "172.16.0.12/24", 214 | "tenant": null, 215 | "status": "active", 216 | "role": null, 217 | "assigned_object_type": null, 218 | "assigned_object": null, 219 | "dns_name": "", 220 | "description": "", 221 | "comments": "", 222 | "tags": [], 223 | "custom_fields": {}, 224 | "created": "2022-04-08T00:25:22.756000Z", 225 | "last_updated": "2022-04-08T00:25:22.756000Z" 226 | }, 227 | { 228 | "family": { 229 | "value": 4, 230 | "label": "IPv4" 231 | }, 232 | "address": "172.16.0.13/24", 233 | "tenant": null, 234 | "status": "active", 235 | "role": null, 236 | "assigned_object_type": null, 237 | "assigned_object": null, 238 | "dns_name": "", 239 | "description": "", 240 | "comments": "", 241 | "tags": [], 242 | "custom_fields": {}, 243 | "created": "2022-04-08T00:25:22.846000Z", 244 | "last_updated": "2022-04-08T00:25:22.846000Z" 245 | }, 246 | { 247 | "family": { 248 | "value": 4, 249 | "label": "IPv4" 250 | }, 251 | "address": "172.16.0.14/24", 252 | "tenant": null, 253 | "status": "active", 254 | "role": null, 255 | "assigned_object_type": null, 256 | "assigned_object": null, 257 | "dns_name": "", 258 | "description": "", 259 | "comments": "", 260 | "tags": [], 261 | "custom_fields": {}, 262 | "created": "2022-04-08T00:25:22.936000Z", 263 | "last_updated": "2022-04-08T00:25:22.936000Z" 264 | }, 265 | { 266 | "family": { 267 | "value": 4, 268 | "label": "IPv4" 269 | }, 270 | "address": "172.16.0.15/24", 271 | "tenant": null, 272 | "status": "active", 273 | "role": null, 274 | "assigned_object_type": null, 275 | "assigned_object": null, 276 | "dns_name": "", 277 | "description": "", 278 | "comments": "", 279 | "tags": [], 280 | "custom_fields": {}, 281 | "created": "2022-04-08T00:25:23.026000Z", 282 | "last_updated": "2022-04-08T00:25:23.026000Z" 283 | }, 284 | { 285 | "family": { 286 | "value": 4, 287 | "label": "IPv4" 288 | }, 289 | "address": "172.16.0.16/24", 290 | "tenant": null, 291 | "status": "active", 292 | "role": null, 293 | "assigned_object_type": null, 294 | "assigned_object": null, 295 | "dns_name": "", 296 | "description": "", 297 | "comments": "", 298 | "tags": [], 299 | "custom_fields": {}, 300 | "created": "2022-04-08T00:25:23.135000Z", 301 | "last_updated": "2022-04-08T00:25:23.135000Z" 302 | }, 303 | { 304 | "family": { 305 | "value": 4, 306 | "label": "IPv4" 307 | }, 308 | "address": "172.16.0.17/24", 309 | "tenant": null, 310 | "status": "active", 311 | "role": null, 312 | "assigned_object_type": null, 313 | "assigned_object": null, 314 | "dns_name": "", 315 | "description": "", 316 | "comments": "", 317 | "tags": [], 318 | "custom_fields": {}, 319 | "created": "2022-04-08T00:25:23.268000Z", 320 | "last_updated": "2022-04-08T00:25:23.268000Z" 321 | }, 322 | { 323 | "family": { 324 | "value": 4, 325 | "label": "IPv4" 326 | }, 327 | "address": "172.16.0.18/24", 328 | "tenant": null, 329 | "status": "active", 330 | "role": null, 331 | "assigned_object_type": null, 332 | "assigned_object": null, 333 | "dns_name": "", 334 | "description": "", 335 | "comments": "", 336 | "tags": [], 337 | "custom_fields": {}, 338 | "created": "2022-04-08T00:25:23.385000Z", 339 | "last_updated": "2022-04-08T00:25:23.385000Z" 340 | }, 341 | { 342 | "family": { 343 | "value": 4, 344 | "label": "IPv4" 345 | }, 346 | "address": "172.16.0.19/24", 347 | "tenant": null, 348 | "status": "active", 349 | "role": null, 350 | "assigned_object_type": null, 351 | "assigned_object": null, 352 | "dns_name": "", 353 | "description": "", 354 | "comments": "", 355 | "tags": [], 356 | "custom_fields": {}, 357 | "created": "2022-04-08T00:25:23.482000Z", 358 | "last_updated": "2022-04-08T00:25:23.482000Z" 359 | }, 360 | { 361 | "family": { 362 | "value": 4, 363 | "label": "IPv4" 364 | }, 365 | "address": "172.16.0.20/24", 366 | "tenant": null, 367 | "status": "active", 368 | "role": null, 369 | "assigned_object_type": null, 370 | "assigned_object": null, 371 | "dns_name": "", 372 | "description": "", 373 | "comments": "", 374 | "tags": [], 375 | "custom_fields": {}, 376 | "created": "2022-04-08T00:25:23.570000Z", 377 | "last_updated": "2022-04-08T00:25:23.570000Z" 378 | }, 379 | { 380 | "family": { 381 | "value": 4, 382 | "label": "IPv4" 383 | }, 384 | "address": "172.16.0.21/24", 385 | "tenant": null, 386 | "status": "active", 387 | "role": null, 388 | "assigned_object_type": null, 389 | "assigned_object": null, 390 | "dns_name": "", 391 | "description": "", 392 | "comments": "", 393 | "tags": [], 394 | "custom_fields": {}, 395 | "created": "2022-04-08T00:25:23.660000Z", 396 | "last_updated": "2022-04-08T00:25:23.660000Z" 397 | }, 398 | { 399 | "family": { 400 | "value": 4, 401 | "label": "IPv4" 402 | }, 403 | "address": "172.16.0.22/24", 404 | "tenant": null, 405 | "status": "active", 406 | "role": null, 407 | "assigned_object_type": null, 408 | "assigned_object": null, 409 | "dns_name": "", 410 | "description": "", 411 | "comments": "", 412 | "tags": [], 413 | "custom_fields": {}, 414 | "created": "2022-04-08T00:25:23.760000Z", 415 | "last_updated": "2022-04-08T00:25:23.760000Z" 416 | }, 417 | { 418 | "family": { 419 | "value": 4, 420 | "label": "IPv4" 421 | }, 422 | "address": "172.16.0.23/24", 423 | "tenant": null, 424 | "status": "active", 425 | "role": null, 426 | "assigned_object_type": null, 427 | "assigned_object": null, 428 | "dns_name": "", 429 | "description": "", 430 | "comments": "", 431 | "tags": [], 432 | "custom_fields": {}, 433 | "created": "2022-04-08T00:25:23.852000Z", 434 | "last_updated": "2022-04-08T00:25:23.852000Z" 435 | }, 436 | { 437 | "family": { 438 | "value": 4, 439 | "label": "IPv4" 440 | }, 441 | "address": "172.16.0.24/24", 442 | "tenant": null, 443 | "status": "active", 444 | "role": null, 445 | "assigned_object_type": null, 446 | "assigned_object": null, 447 | "dns_name": "", 448 | "description": "", 449 | "comments": "", 450 | "tags": [], 451 | "custom_fields": {}, 452 | "created": "2022-04-08T00:25:23.949000Z", 453 | "last_updated": "2022-04-08T00:25:23.949000Z" 454 | }, 455 | { 456 | "family": { 457 | "value": 4, 458 | "label": "IPv4" 459 | }, 460 | "address": "172.16.0.25/24", 461 | "tenant": null, 462 | "status": "active", 463 | "role": null, 464 | "assigned_object_type": null, 465 | "assigned_object": null, 466 | "dns_name": "", 467 | "description": "", 468 | "comments": "", 469 | "tags": [], 470 | "custom_fields": {}, 471 | "created": "2022-04-08T00:25:24.038000Z", 472 | "last_updated": "2022-04-08T00:25:24.038000Z" 473 | }, 474 | { 475 | "family": { 476 | "value": 4, 477 | "label": "IPv4" 478 | }, 479 | "address": "172.16.0.26/24", 480 | "tenant": null, 481 | "status": "active", 482 | "role": null, 483 | "assigned_object_type": null, 484 | "assigned_object": null, 485 | "dns_name": "", 486 | "description": "", 487 | "comments": "", 488 | "tags": [], 489 | "custom_fields": {}, 490 | "created": "2022-04-08T00:25:24.124000Z", 491 | "last_updated": "2022-04-08T00:25:24.124000Z" 492 | }, 493 | { 494 | "family": { 495 | "value": 4, 496 | "label": "IPv4" 497 | }, 498 | "address": "172.16.0.27/24", 499 | "tenant": null, 500 | "status": "active", 501 | "role": null, 502 | "assigned_object_type": null, 503 | "assigned_object": null, 504 | "dns_name": "", 505 | "description": "", 506 | "comments": "", 507 | "tags": [], 508 | "custom_fields": {}, 509 | "created": "2022-04-08T00:25:24.211000Z", 510 | "last_updated": "2022-04-08T00:25:24.211000Z" 511 | }, 512 | { 513 | "family": { 514 | "value": 4, 515 | "label": "IPv4" 516 | }, 517 | "address": "172.16.0.28/24", 518 | "tenant": null, 519 | "status": "active", 520 | "role": null, 521 | "assigned_object_type": null, 522 | "assigned_object": null, 523 | "dns_name": "", 524 | "description": "", 525 | "comments": "", 526 | "tags": [], 527 | "custom_fields": {}, 528 | "created": "2022-04-08T00:25:24.300000Z", 529 | "last_updated": "2022-04-08T00:25:24.300000Z" 530 | }, 531 | { 532 | "family": { 533 | "value": 4, 534 | "label": "IPv4" 535 | }, 536 | "address": "172.16.0.29/24", 537 | "tenant": null, 538 | "status": "active", 539 | "role": null, 540 | "assigned_object_type": null, 541 | "assigned_object": null, 542 | "dns_name": "", 543 | "description": "", 544 | "comments": "", 545 | "tags": [], 546 | "custom_fields": {}, 547 | "created": "2022-04-08T00:25:24.393000Z", 548 | "last_updated": "2022-04-08T00:25:24.393000Z" 549 | }, 550 | { 551 | "family": { 552 | "value": 4, 553 | "label": "IPv4" 554 | }, 555 | "address": "172.16.0.30/24", 556 | "tenant": null, 557 | "status": "active", 558 | "role": null, 559 | "assigned_object_type": null, 560 | "assigned_object": null, 561 | "dns_name": "", 562 | "description": "", 563 | "comments": "", 564 | "tags": [], 565 | "custom_fields": {}, 566 | "created": "2022-04-08T00:25:24.516000Z", 567 | "last_updated": "2022-04-08T00:25:24.516000Z" 568 | }, 569 | { 570 | "family": { 571 | "value": 4, 572 | "label": "IPv4" 573 | }, 574 | "address": "172.17.0.1/24", 575 | "tenant": null, 576 | "status": "active", 577 | "role": null, 578 | "assigned_object_type": null, 579 | "assigned_object": null, 580 | "dns_name": "", 581 | "description": "", 582 | "comments": "", 583 | "tags": [], 584 | "custom_fields": {}, 585 | "created": "2022-04-08T00:25:24.627000Z", 586 | "last_updated": "2022-04-08T00:25:24.627000Z" 587 | }, 588 | { 589 | "family": { 590 | "value": 4, 591 | "label": "IPv4" 592 | }, 593 | "address": "172.17.0.2/24", 594 | "tenant": null, 595 | "status": "active", 596 | "role": null, 597 | "assigned_object_type": null, 598 | "assigned_object": null, 599 | "dns_name": "", 600 | "description": "", 601 | "comments": "", 602 | "tags": [], 603 | "custom_fields": {}, 604 | "created": "2022-04-08T00:25:24.753000Z", 605 | "last_updated": "2022-04-08T00:25:24.753000Z" 606 | }, 607 | { 608 | "family": { 609 | "value": 4, 610 | "label": "IPv4" 611 | }, 612 | "address": "172.17.0.3/24", 613 | "tenant": null, 614 | "status": "active", 615 | "role": null, 616 | "assigned_object_type": null, 617 | "assigned_object": null, 618 | "dns_name": "", 619 | "description": "", 620 | "comments": "", 621 | "tags": [], 622 | "custom_fields": {}, 623 | "created": "2022-04-08T00:25:24.873000Z", 624 | "last_updated": "2022-04-08T00:25:24.873000Z" 625 | }, 626 | { 627 | "family": { 628 | "value": 4, 629 | "label": "IPv4" 630 | }, 631 | "address": "172.17.0.4/24", 632 | "tenant": null, 633 | "status": "active", 634 | "role": null, 635 | "assigned_object_type": null, 636 | "assigned_object": null, 637 | "dns_name": "", 638 | "description": "", 639 | "comments": "", 640 | "tags": [], 641 | "custom_fields": {}, 642 | "created": "2022-04-08T00:25:24.976000Z", 643 | "last_updated": "2022-04-08T00:25:24.976000Z" 644 | }, 645 | { 646 | "family": { 647 | "value": 4, 648 | "label": "IPv4" 649 | }, 650 | "address": "172.17.0.5/24", 651 | "tenant": null, 652 | "status": "active", 653 | "role": null, 654 | "assigned_object_type": null, 655 | "assigned_object": null, 656 | "dns_name": "", 657 | "description": "", 658 | "comments": "", 659 | "tags": [], 660 | "custom_fields": {}, 661 | "created": "2022-04-08T00:25:25.079000Z", 662 | "last_updated": "2022-04-08T00:25:25.079000Z" 663 | }, 664 | { 665 | "family": { 666 | "value": 4, 667 | "label": "IPv4" 668 | }, 669 | "address": "172.17.0.6/24", 670 | "tenant": null, 671 | "status": "active", 672 | "role": null, 673 | "assigned_object_type": null, 674 | "assigned_object": null, 675 | "dns_name": "", 676 | "description": "", 677 | "comments": "", 678 | "tags": [], 679 | "custom_fields": {}, 680 | "created": "2022-04-08T00:25:25.193000Z", 681 | "last_updated": "2022-04-08T00:25:25.193000Z" 682 | }, 683 | { 684 | "family": { 685 | "value": 4, 686 | "label": "IPv4" 687 | }, 688 | "address": "172.17.0.7/24", 689 | "tenant": null, 690 | "status": "active", 691 | "role": null, 692 | "assigned_object_type": null, 693 | "assigned_object": null, 694 | "dns_name": "", 695 | "description": "", 696 | "comments": "", 697 | "tags": [], 698 | "custom_fields": {}, 699 | "created": "2022-04-08T00:25:25.321000Z", 700 | "last_updated": "2022-04-08T00:25:25.321000Z" 701 | }, 702 | { 703 | "family": { 704 | "value": 4, 705 | "label": "IPv4" 706 | }, 707 | "address": "172.17.0.8/24", 708 | "tenant": null, 709 | "status": "active", 710 | "role": null, 711 | "assigned_object_type": null, 712 | "assigned_object": null, 713 | "dns_name": "", 714 | "description": "", 715 | "comments": "", 716 | "tags": [], 717 | "custom_fields": {}, 718 | "created": "2022-04-08T00:25:25.410000Z", 719 | "last_updated": "2022-04-08T00:25:25.410000Z" 720 | }, 721 | { 722 | "family": { 723 | "value": 4, 724 | "label": "IPv4" 725 | }, 726 | "address": "172.17.0.9/24", 727 | "tenant": null, 728 | "status": "active", 729 | "role": null, 730 | "assigned_object_type": null, 731 | "assigned_object": null, 732 | "dns_name": "", 733 | "description": "", 734 | "comments": "", 735 | "tags": [], 736 | "custom_fields": {}, 737 | "created": "2022-04-08T00:25:25.508000Z", 738 | "last_updated": "2022-04-08T00:25:25.508000Z" 739 | }, 740 | { 741 | "family": { 742 | "value": 4, 743 | "label": "IPv4" 744 | }, 745 | "address": "172.17.0.10/24", 746 | "tenant": null, 747 | "status": "active", 748 | "role": null, 749 | "assigned_object_type": null, 750 | "assigned_object": null, 751 | "dns_name": "", 752 | "description": "", 753 | "comments": "", 754 | "tags": [], 755 | "custom_fields": {}, 756 | "created": "2022-04-08T00:25:25.605000Z", 757 | "last_updated": "2022-04-08T00:25:25.605000Z" 758 | }, 759 | { 760 | "family": { 761 | "value": 4, 762 | "label": "IPv4" 763 | }, 764 | "address": "172.17.0.11/24", 765 | "tenant": null, 766 | "status": "active", 767 | "role": null, 768 | "assigned_object_type": null, 769 | "assigned_object": null, 770 | "dns_name": "", 771 | "description": "", 772 | "comments": "", 773 | "tags": [], 774 | "custom_fields": {}, 775 | "created": "2022-04-08T00:25:25.693000Z", 776 | "last_updated": "2022-04-08T00:25:25.693000Z" 777 | }, 778 | { 779 | "family": { 780 | "value": 4, 781 | "label": "IPv4" 782 | }, 783 | "address": "172.17.0.12/24", 784 | "tenant": null, 785 | "status": "active", 786 | "role": null, 787 | "assigned_object_type": null, 788 | "assigned_object": null, 789 | "dns_name": "", 790 | "description": "", 791 | "comments": "", 792 | "tags": [], 793 | "custom_fields": {}, 794 | "created": "2022-04-08T00:25:25.779000Z", 795 | "last_updated": "2022-04-08T00:25:25.779000Z" 796 | }, 797 | { 798 | "family": { 799 | "value": 4, 800 | "label": "IPv4" 801 | }, 802 | "address": "172.17.0.13/24", 803 | "tenant": null, 804 | "status": "active", 805 | "role": null, 806 | "assigned_object_type": null, 807 | "assigned_object": null, 808 | "dns_name": "", 809 | "description": "", 810 | "comments": "", 811 | "tags": [], 812 | "custom_fields": {}, 813 | "created": "2022-04-08T00:25:25.868000Z", 814 | "last_updated": "2022-04-08T00:25:25.868000Z" 815 | }, 816 | { 817 | "family": { 818 | "value": 4, 819 | "label": "IPv4" 820 | }, 821 | "address": "172.17.0.14/24", 822 | "tenant": null, 823 | "status": "active", 824 | "role": null, 825 | "assigned_object_type": null, 826 | "assigned_object": null, 827 | "dns_name": "", 828 | "description": "", 829 | "comments": "", 830 | "tags": [], 831 | "custom_fields": {}, 832 | "created": "2022-04-08T00:25:25.996000Z", 833 | "last_updated": "2022-04-08T00:25:25.996000Z" 834 | }, 835 | { 836 | "family": { 837 | "value": 4, 838 | "label": "IPv4" 839 | }, 840 | "address": "172.17.0.15/24", 841 | "tenant": null, 842 | "status": "active", 843 | "role": null, 844 | "assigned_object_type": null, 845 | "assigned_object": null, 846 | "dns_name": "", 847 | "description": "", 848 | "comments": "", 849 | "tags": [], 850 | "custom_fields": {}, 851 | "created": "2022-04-08T00:25:26.108000Z", 852 | "last_updated": "2022-04-08T00:25:26.108000Z" 853 | }, 854 | { 855 | "family": { 856 | "value": 4, 857 | "label": "IPv4" 858 | }, 859 | "address": "172.17.0.16/24", 860 | "tenant": null, 861 | "status": "active", 862 | "role": null, 863 | "assigned_object_type": null, 864 | "assigned_object": null, 865 | "dns_name": "", 866 | "description": "", 867 | "comments": "", 868 | "tags": [], 869 | "custom_fields": {}, 870 | "created": "2022-04-08T00:25:26.219000Z", 871 | "last_updated": "2022-04-08T00:25:26.219000Z" 872 | }, 873 | { 874 | "family": { 875 | "value": 4, 876 | "label": "IPv4" 877 | }, 878 | "address": "172.17.0.17/24", 879 | "tenant": null, 880 | "status": "active", 881 | "role": null, 882 | "assigned_object_type": null, 883 | "assigned_object": null, 884 | "dns_name": "", 885 | "description": "", 886 | "comments": "", 887 | "tags": [], 888 | "custom_fields": {}, 889 | "created": "2022-04-08T00:25:26.329000Z", 890 | "last_updated": "2022-04-08T00:25:26.329000Z" 891 | }, 892 | { 893 | "family": { 894 | "value": 4, 895 | "label": "IPv4" 896 | }, 897 | "address": "172.17.0.18/24", 898 | "tenant": null, 899 | "status": "active", 900 | "role": null, 901 | "assigned_object_type": null, 902 | "assigned_object": null, 903 | "dns_name": "", 904 | "description": "", 905 | "comments": "", 906 | "tags": [], 907 | "custom_fields": {}, 908 | "created": "2022-04-08T00:25:26.426000Z", 909 | "last_updated": "2022-04-08T00:25:26.426000Z" 910 | }, 911 | { 912 | "family": { 913 | "value": 4, 914 | "label": "IPv4" 915 | }, 916 | "address": "172.17.0.19/24", 917 | "tenant": null, 918 | "status": "active", 919 | "role": null, 920 | "assigned_object_type": null, 921 | "assigned_object": null, 922 | "dns_name": "", 923 | "description": "", 924 | "comments": "", 925 | "tags": [], 926 | "custom_fields": {}, 927 | "created": "2022-04-08T00:25:26.513000Z", 928 | "last_updated": "2022-04-08T00:25:26.513000Z" 929 | }, 930 | { 931 | "family": { 932 | "value": 4, 933 | "label": "IPv4" 934 | }, 935 | "address": "172.17.0.20/24", 936 | "tenant": null, 937 | "status": "active", 938 | "role": null, 939 | "assigned_object_type": null, 940 | "assigned_object": null, 941 | "dns_name": "", 942 | "description": "", 943 | "comments": "", 944 | "tags": [], 945 | "custom_fields": {}, 946 | "created": "2022-04-08T00:25:26.598000Z", 947 | "last_updated": "2022-04-08T00:25:26.598000Z" 948 | } 949 | ] 950 | -------------------------------------------------------------------------------- /utils/default.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | let 3 | utils = lib.makeExtensible (self: 4 | let 5 | callUtils = file: import file { inherit lib; utils = self; }; 6 | in 7 | { 8 | networking = callUtils ./networking.nix; 9 | }); 10 | in 11 | utils 12 | -------------------------------------------------------------------------------- /utils/networking.nix: -------------------------------------------------------------------------------- 1 | { lib, utils, ... }: 2 | let 3 | inherit (builtins) length head; 4 | inherit (lib.trivial) throwIf; 5 | inherit (lib.strings) concatStrings; 6 | inherit (lib.lists) foldr last range; 7 | inherit (utils.networking) splitWhen; 8 | in 9 | { 10 | 11 | /** 12 | # Description 13 | 14 | Generates inclusive portrange given a lower and a higher number, 15 | additionally throws an error if the end of the range is not strictly 16 | greater. 17 | 18 | # Type 19 | 20 | ``` 21 | utils.networking.portrange :: Int -> Int -> [ Int ] 22 | ``` 23 | */ 24 | rangeToPorts = from: to: 25 | let ports = range from to; 26 | in throwIf (length ports == 0) 27 | (concatStrings [ 28 | "the second input has to be larger then the first one, " 29 | "otherwise you have a negative range which is impossible " 30 | "or not a range." 31 | ]) 32 | ports; 33 | 34 | /** 35 | # Example 36 | 37 | ```nix 38 | let formatRange = { start, end }: "${toString start}-${toString end}" 39 | in map (x: if isAttrs x then formatRange x else x) 40 | (portsToRanges [ 1 2 3 ]) 41 | => [ "1-3" ] 42 | ``` 43 | 44 | # Type 45 | 46 | ``` 47 | utils.networking.portsToRanges :: [Int] -> [Int + { start end :: Int }] 48 | ``` 49 | */ 50 | portsToRanges = ports: 51 | let 52 | partitioned = splitWhen (a: b: a + 1 == b) ports; 53 | format = range: 54 | if length range == 1 55 | then head range 56 | else { start = head range; end = last range; }; 57 | in 58 | map format partitioned; 59 | 60 | /** 61 | # Example 62 | 63 | ```nix 64 | # split into strictly ordered sublists 65 | splitWhen (a: b: a < b) [ 7 8 9 4 5 6 1 2 3 ] 66 | => [ [ 7 8 9 ] [ 4 5 6 ] [ 1 2 3 ] ] 67 | ``` 68 | 69 | # Type 70 | 71 | ``` 72 | utils.networking.splitWhen :: (a -> a -> Bool) -> [a] -> [[a]] 73 | ``` 74 | */ 75 | splitWhen = p: xs: 76 | let 77 | unfold = { xs, xss }: 78 | if length xs == 0 then xss else [ xs ] ++ xss; 79 | 80 | addElement = x: { xs, xss }: 81 | if length xs == 0 82 | then { xs = [ x ]; inherit xss; } 83 | else if p x (head xs) 84 | then { xs = [ x ] ++ xs; inherit xss; } 85 | else { xs = [ x ]; xss = [ xs ] ++ xss; }; 86 | in 87 | unfold (foldr addElement { xs = [ ]; xss = [ ]; } xs); 88 | 89 | } 90 | -------------------------------------------------------------------------------- /utils/templates.nix: -------------------------------------------------------------------------------- 1 | { lib, utils, ... }: 2 | { 3 | networkd = { 4 | mkWanInterface = host: { 5 | # disable dhcp since we use static ips; 6 | networkConfig.DHCP = "no"; 7 | # utils.match.ips is not yet implemented 8 | # but once it is it should return attrset of all the ips 9 | # matching the domain in `host`, something like `host1.example.com` 10 | # and the label `wan` 11 | address = lib.attrNames (utils.match.ips host "wan"); 12 | matchConfig.Name = (utils.match.devieces host).interfaces; 13 | linkConfig.RequiredForOnline = "routable"; 14 | routes = [ 15 | ]; 16 | }; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /utils/tests/networking.nix: -------------------------------------------------------------------------------- 1 | { self, lib, utils }: 2 | { 3 | testRangeToPorts = { 4 | expr = utils.networking.rangeToPorts 8000 8100; 5 | expected = [ 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 ]; 6 | }; 7 | testPortsToRagnes = { 8 | expr = utils.networking.portsToRanges [ 22 80 81 82 83 8100 9000 9001 9002 ]; 9 | expected = [ 22 { start = 80; end = 83; } 8100 { start = 9000; end = 9002; } ]; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /utils/types.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: rec { 2 | ipv4Address = lib.types.mkOptionType { 3 | name = "ipv4Address"; 4 | description = ""; 5 | check = "todo"; 6 | }; 7 | ipv6Address = lib.types.mkOptionType { 8 | name = "ipv6Address"; 9 | description = ""; 10 | check = "todo"; 11 | }; 12 | ipAddress = lib.types.mkOptionType { 13 | name = "ipv6Address"; 14 | description = ""; 15 | check = "oneOf [ ipv4Address ipv6Address ]"; 16 | }; 17 | ipv4AddressWithMask = lib.types.mkOptionType { 18 | name = "ipv4AddressWithMask"; 19 | description = ""; 20 | check = "ipv4Address+/[0-32]"; 21 | }; 22 | ipv6AddressWithMask = lib.types.mkOptionType { 23 | name = "ipv6AddressWithMask"; 24 | description = ""; 25 | check = "ipv6Address+/[0-128]"; 26 | }; 27 | } 28 | --------------------------------------------------------------------------------