Skip to content

Commit

Permalink
topology: init
Browse files Browse the repository at this point in the history
  • Loading branch information
peterablehmann committed Apr 13, 2024
1 parent e955018 commit 4be87f1
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 9 deletions.
216 changes: 212 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

# Attic
attic.url = "github:zhaofengli/attic";

# Nix-Topology
nix-topology.url = "github:oddlama/nix-topology";
};

outputs =
Expand All @@ -31,6 +34,7 @@
, flake-utils
, colmena
, attic
, nix-topology
, ...
} @ inputs:
let
Expand Down Expand Up @@ -69,6 +73,7 @@
modules = [
./nodes/mns
self.nixosModules.common
nix-topology.nixosModules.default
];
};
monitoring = nixpkgs.lib.nixosSystem {
Expand All @@ -78,6 +83,7 @@
modules = [
./nodes/monitoring
self.nixosModules.common
nix-topology.nixosModules.default
];
};
sync = nixpkgs.lib.nixosSystem {
Expand All @@ -87,6 +93,7 @@
modules = [
./nodes/sync
self.nixosModules.common
nix-topology.nixosModules.default
];
};
cache = nixpkgs.lib.nixosSystem {
Expand All @@ -96,6 +103,7 @@
modules = [
./nodes/cache
self.nixosModules.common
nix-topology.nixosModules.default
];
};
};
Expand All @@ -105,5 +113,21 @@
};

formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
};
} // flake-utils.lib.eachDefaultSystem (system: rec {
pkgs = import nixpkgs {
inherit system;
overlays = [ nix-topology.overlays.default ];
};

topology = import nix-topology {
inherit pkgs;
modules = [
# Your own file to define global topology. Works in principle like a nixos module but uses different options.
# ./topology.nix
# Inline module to inform topology of your existing NixOS hosts.
./topology.nix
{ inherit (self) nixosConfigurations; }
];
};
});
}
Binary file added media/fritzbox_7590.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions modules/common/tailscale.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
, ...
}:
{
topology.self.interfaces.tailscale0.network = "tailnet";

sops.secrets."tailscale/authkey" = {
sopsFile = "${inputs.self}/secrets/common.yaml";
};
Expand Down
8 changes: 4 additions & 4 deletions nodes/cache/attic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
listen = "127.0.0.1:8080";

storage = {
type = "s3";
endpoint = "https://s3.wasabisys.com";
region = "eu-central-2";
bucket = "cache-xnee-net";
type = "s3";
endpoint = "https://s3.wasabisys.com";
region = "eu-central-2";
bucket = "cache-xnee-net";
};

# Data chunking
Expand Down
8 changes: 8 additions & 0 deletions nodes/cache/networking.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{ lib
, config
, ...
}:
let
inherit (config.lib.topology) mkConnectionRev;
in
{
topology.self.interfaces.eth0 = {
network = "Internet";
physicalConnections = [ (mkConnectionRev "Internet" "*") ];
};
networking = {
useNetworkd = true;
useDHCP = false;
Expand Down
Loading

0 comments on commit 4be87f1

Please sign in to comment.