From 66cc00087e076058123e7d04f962e16cd7ce4a9c Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Sat, 1 Jun 2024 13:14:58 +1000
Subject: [PATCH] nix-topology
---
dev/docs.nix | 3 ++-
dev/topology.nix | 22 ++++++++++++++++++++++
docs/infrastructure.md | 7 +++++++
flake.lock | 30 ++++++++++++++++++++++++++++++
flake.nix | 7 +++++++
mkdocs.yml | 1 +
modules/nixos/common/default.nix | 1 +
7 files changed, 70 insertions(+), 1 deletion(-)
create mode 100644 dev/topology.nix
create mode 100644 docs/infrastructure.md
diff --git a/dev/docs.nix b/dev/docs.nix
index d86eda092..30443575b 100644
--- a/dev/docs.nix
+++ b/dev/docs.nix
@@ -15,7 +15,8 @@
};
}
''
- cd $files
+ cp --no-preserve=mode -r $files/* .
+ cp --no-preserve=mode -r ${config.packages.topology-output}/* docs
mkdocs build --strict --site-dir $out
'';
docs-linkcheck = pkgs.testers.lycheeLinkCheck rec {
diff --git a/dev/topology.nix b/dev/topology.nix
new file mode 100644
index 000000000..e336a99c5
--- /dev/null
+++ b/dev/topology.nix
@@ -0,0 +1,22 @@
+{ self, ... }:
+{
+ perSystem =
+ { system, ... }:
+ {
+ topology.modules = [
+ {
+ nodes = {
+ darwin01 = {
+ name = "darwin01";
+ deviceType = "nixos";
+ };
+ darwin02 = {
+ name = "darwin02";
+ deviceType = "nixos";
+ };
+ };
+ }
+ ];
+ packages.topology-output = self.topology.${system}.config.output;
+ };
+}
diff --git a/docs/infrastructure.md b/docs/infrastructure.md
new file mode 100644
index 000000000..53f77f76f
--- /dev/null
+++ b/docs/infrastructure.md
@@ -0,0 +1,7 @@
+#### Main
+
+[](main.svg)
+
+#### Network
+
+[](network.svg)
diff --git a/flake.lock b/flake.lock
index f90b381e7..b791bfb12 100644
--- a/flake.lock
+++ b/flake.lock
@@ -260,6 +260,35 @@
"type": "github"
}
},
+ "nix-topology": {
+ "inputs": {
+ "devshell": [
+ "empty"
+ ],
+ "flake-utils": [
+ "flake-utils"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "pre-commit-hooks": [
+ "empty"
+ ]
+ },
+ "locked": {
+ "lastModified": 1725483443,
+ "narHash": "sha256-WzOlGMKV/51Fccn/OMHcm5yrqgbOJZrJIy1ya4pW0u8=",
+ "owner": "oddlama",
+ "repo": "nix-topology",
+ "rev": "8738d94670265beb166954c4e3a26e432f79f68c",
+ "type": "github"
+ },
+ "original": {
+ "owner": "oddlama",
+ "repo": "nix-topology",
+ "type": "github"
+ }
+ },
"nixos-facter-modules": {
"locked": {
"lastModified": 1728725827,
@@ -383,6 +412,7 @@
"lite-config": "lite-config",
"nix-darwin": "nix-darwin",
"nix-index-database": "nix-index-database",
+ "nix-topology": "nix-topology",
"nixos-facter-modules": "nixos-facter-modules",
"nixpkgs": "nixpkgs",
"nixpkgs-update": "nixpkgs-update",
diff --git a/flake.nix b/flake.nix
index 2fa496bb9..46e34d767 100644
--- a/flake.nix
+++ b/flake.nix
@@ -36,6 +36,11 @@
nix-darwin.url = "github:LnL7/nix-darwin";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:nix-community/nix-index-database";
+ nix-topology.inputs.devshell.follows = "empty";
+ nix-topology.inputs.flake-utils.follows = "flake-utils";
+ nix-topology.inputs.nixpkgs.follows = "nixpkgs";
+ nix-topology.inputs.pre-commit-hooks.follows = "empty";
+ nix-topology.url = "github:oddlama/nix-topology";
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
nixpkgs-update-github-releases.flake = false;
nixpkgs-update-github-releases.url = "github:nix-community/nixpkgs-update-github-releases";
@@ -62,7 +67,9 @@
systems = import inputs.systems;
imports = [
+ ./dev/topology.nix
inputs.lite-config.flakeModule
+ inputs.nix-topology.flakeModule
inputs.treefmt-nix.flakeModule
];
diff --git a/mkdocs.yml b/mkdocs.yml
index 926f16f54..6203d2cca 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -16,6 +16,7 @@ nav:
- FAQ: faq.md
- administrators.md
- contact.md
+ - infrastructure.md
- security.md
theme:
diff --git a/modules/nixos/common/default.nix b/modules/nixos/common/default.nix
index 6a01d5ed5..21954fa85 100644
--- a/modules/nixos/common/default.nix
+++ b/modules/nixos/common/default.nix
@@ -15,6 +15,7 @@
./update.nix
./users.nix
inputs.srvos.nixosModules.server
+ inputs.nix-topology.nixosModules.default
];
# Hard-link duplicated files