Merge pull request 'init topology && more flake modules' () from init-topology-and-modules into master

Reviewed-on: 
This commit is contained in:
notohh 2025-02-08 18:06:09 -05:00
commit 420c50d4d8
41 changed files with 530 additions and 91 deletions

191
flake.lock generated
View file

@ -515,6 +515,27 @@
"type": "github"
}
},
"devshell": {
"inputs": {
"nixpkgs": [
"nix-topology",
"nixpkgs"
]
},
"locked": {
"lastModified": 1728330715,
"narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=",
"owner": "numtide",
"repo": "devshell",
"rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "devshell",
"type": "github"
}
},
"eww": {
"inputs": {
"flake-compat": "flake-compat_7",
@ -649,20 +670,6 @@
}
},
"flake-compat_12": {
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"revCount": 69,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_13": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -678,7 +685,37 @@
"type": "github"
}
},
"flake-compat_13": {
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"revCount": 69,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_14": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_15": {
"flake": false,
"locked": {
"lastModified": 1733328505,
@ -1119,11 +1156,11 @@
"systems": "systems_22"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
@ -1168,6 +1205,24 @@
"type": "github"
}
},
"flake-utils_9": {
"inputs": {
"systems": "systems_25"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flocon": {
"inputs": {
"agenix": "agenix",
@ -1322,6 +1377,28 @@
}
},
"gitignore_5": {
"inputs": {
"nixpkgs": [
"nix-topology",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_6": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
@ -3119,6 +3196,29 @@
"type": "github"
}
},
"nix-topology": {
"inputs": {
"devshell": "devshell",
"flake-utils": "flake-utils_6",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks_4"
},
"locked": {
"lastModified": 1738246091,
"narHash": "sha256-2+KkZsRO+XlOFbXbRgMZbRtlqn5MBNYj4HNmZ/2Tojg=",
"owner": "oddlama",
"repo": "nix-topology",
"rev": "5526269fa3eedf4f4bc00c0bf7a03db31d24b029",
"type": "github"
},
"original": {
"owner": "oddlama",
"repo": "nix-topology",
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1738816619,
@ -3276,8 +3376,8 @@
},
"nixpkgs-xr": {
"inputs": {
"flake-compat": "flake-compat_12",
"flake-utils": "flake-utils_6",
"flake-compat": "flake-compat_13",
"flake-utils": "flake-utils_7",
"nixpkgs": "nixpkgs_19",
"treefmt-nix": "treefmt-nix_2"
},
@ -6604,8 +6704,35 @@
},
"pre-commit-hooks_4": {
"inputs": {
"flake-compat": "flake-compat_13",
"flake-compat": "flake-compat_12",
"gitignore": "gitignore_5",
"nixpkgs": [
"nix-topology",
"nixpkgs"
],
"nixpkgs-stable": [
"nix-topology",
"nixpkgs"
]
},
"locked": {
"lastModified": 1730797577,
"narHash": "sha256-SrID5yVpyUfknUTGWgYkTyvdr9J1LxUym4om3SVGPkg=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "1864030ed24a2b8b4e4d386a5eeaf0c5369e50a9",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pre-commit-hooks_5": {
"inputs": {
"flake-compat": "flake-compat_14",
"gitignore": "gitignore_6",
"nixpkgs": "nixpkgs_21"
},
"locked": {
@ -6624,7 +6751,7 @@
},
"prismlauncher": {
"inputs": {
"flake-compat": "flake-compat_14",
"flake-compat": "flake-compat_15",
"libnbtplusplus": "libnbtplusplus",
"nix-filter": "nix-filter_2",
"nixpkgs": "nixpkgs_22"
@ -6706,11 +6833,12 @@
"hyprwayland-scanner": "hyprwayland-scanner_11",
"manga-tui": "manga-tui",
"nix-gaming": "nix-gaming_2",
"nix-topology": "nix-topology",
"nixos-hardware": "nixos-hardware_2",
"nixpkgs": "nixpkgs_18",
"nixpkgs-xr": "nixpkgs-xr",
"nur": "nur",
"pre-commit-hooks": "pre-commit-hooks_4",
"pre-commit-hooks": "pre-commit-hooks_5",
"prismlauncher": "prismlauncher",
"scls": "scls",
"sops-nix": "sops-nix",
@ -6878,7 +7006,7 @@
},
"scls": {
"inputs": {
"flake-utils": "flake-utils_7",
"flake-utils": "flake-utils_8",
"naersk": "naersk",
"nixpkgs": [
"nixpkgs"
@ -7173,6 +7301,21 @@
"type": "github"
}
},
"systems_25": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1689347949,
@ -7483,7 +7626,7 @@
},
"yazi": {
"inputs": {
"flake-utils": "flake-utils_8",
"flake-utils": "flake-utils_9",
"nixpkgs": "nixpkgs_23",
"rust-overlay": "rust-overlay_5"
},

View file

@ -4,9 +4,9 @@
outputs = inputs:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.pre-commit-hooks.flakeModule
./hosts
./overlays
./modules
./hosts/deploy.nix
./home/profiles
];
@ -16,28 +16,6 @@
pkgs,
...
}: {
pre-commit = {
check.enable = true;
settings = {
excludes = ["flake.lock"];
hooks = {
stylua.enable = true;
statix.enable = true;
alejandra.enable = true;
deadnix = {
enable = true;
excludes = ["technorino.nix"];
};
prettier = {
enable = true;
files = "\\.(js|ts|md|json)$";
settings = {
trailing-comma = "none";
};
};
};
};
};
devShells.default = pkgs.mkShell {
name = "snowflake";
shellHook = config.pre-commit.installationScript;
@ -137,5 +115,9 @@
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-topology = {
url = "github:oddlama/nix-topology";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}

View file

@ -39,6 +39,7 @@ alias tail = tspin
alias spotify = spotify_player
alias atac = atac --directory ~/.config/atac/
alias zed = zeditor .
alias generate-topology = nix build ".#topology.x86_64-linux.config.output"
nitch
$env.config = {
@ -221,7 +222,7 @@ $env.config = {
| where command =~ $buffer
| each { |it| {value: $it.command description: $it.usage} }
}
}
}
]
keybindings: [
{
@ -325,7 +326,7 @@ $env.config = {
event: { send: menu name: commands_with_description }
}
]
}

View file

@ -3,9 +3,9 @@ _: {
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
../../modules/fonts.nix
./topology.nix
../common
../common/fonts.nix
];
programs.hyprland.enable = true;

20
hosts/ame/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "ame";
hardware.info = "Thinkpad T480";
interfaces = {
tailscale0 = {
addresses = ["100.108.207.106/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
network = "home";
addresses = [""];
type = "wifi";
};
};
};
};
}

View file

@ -3,8 +3,8 @@
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

20
hosts/arashi/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "arashi";
hardware.info = "Proxmox VM";
interfaces = {
tailscale0 = {
addresses = ["100.94.214.100/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.211/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -1,8 +0,0 @@
{inputs, ...}: {
imports = [
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
inputs.nur.modules.nixos.default
# inputs.attic.nixosModules.atticd
];
}

17
hosts/common/default.nix Normal file
View file

@ -0,0 +1,17 @@
{inputs, ...}: {
imports = [
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.home-manager
inputs.nur.modules.nixos.default
inputs.nix-topology.nixosModules.default
./prometheus.nix
./security.nix
./users.nix
./nix.nix
./system.nix
./openssh.nix
./virtualisation.nix
./sops.nix
./time.nix
];
}

View file

@ -1,6 +1,6 @@
_: {
sops = {
defaultSopsFile = ../secrets/secrets.yaml;
defaultSopsFile = ../../secrets/secrets.yaml;
age.keyFile = "/home/notoh/.config/sops/age/keys.txt";
};
}

View file

@ -3,8 +3,8 @@
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

20
hosts/haru/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "haru";
hardware.info = "Proxmox VM";
interfaces = {
tailscale0 = {
addresses = ["100.73.192.45/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.103/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -3,8 +3,8 @@
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

20
hosts/kariru/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "kariru";
hardware.info = "Proxmox VM";
interfaces = {
tailscale0 = {
addresses = ["100.126.229.95/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.54/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -3,8 +3,8 @@
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

20
hosts/kaze/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "kaze";
hardware.info = "BuyVM VPS";
interfaces = {
tailscale0 = {
addresses = ["100.69.79.81/32"];
network = "tailscale0";
type = "wireguard";
};
eth0 = {
network = "hetzner";
addresses = ["198.98.48.71 "];
type = "ethernet";
};
};
};
};
}

View file

@ -3,8 +3,8 @@ _: {
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

20
hosts/sakura/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "sakura";
hardware.info = "Proxmox VM";
interfaces = {
tailscale0 = {
addresses = ["100.121.201.47/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.25/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -3,8 +3,8 @@ _: {
./hardware.nix
./networking.nix
./services
../common.nix
../../modules
./topology.nix
../common
];
services.snowflake-proxy.enable = true;

19
hosts/sora/topology.nix Normal file
View file

@ -0,0 +1,19 @@
_: {
topology = {
self = {
name = "sora";
hardware.info = "Hetzner VPS";
interfaces = {
tailscale0 = {
addresses = ["100.104.42.96/32"];
network = "tailscale0";
type = "wireguard";
};
eth0 = {
network = "hetzner";
type = "ethernet";
};
};
};
};
}

View file

@ -10,10 +10,10 @@
./services
./networking.nix
./gaming.nix
../common.nix
./topology.nix
../common
../common/fonts.nix
../../home/wayland
../../modules
../../modules/fonts.nix
];
virtualisation = {

View file

@ -22,7 +22,7 @@
};
};
monado = {
enable = true;
enable = false;
highPriority = true;
};
sunshine = {

20
hosts/tsuki/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "tsuki";
hardware.info = "Desktop";
interfaces = {
tailscale0 = {
addresses = ["100.127.30.116/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.47/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -3,8 +3,8 @@
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

20
hosts/tsuru/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "tsuru";
hardware.info = "Proxmox VM";
interfaces = {
tailscale0 = {
addresses = ["100.82.146.40/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.99/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -3,8 +3,8 @@
./hardware.nix
./services
./networking.nix
../common.nix
../../modules
./topology.nix
../common
];
users = {

View file

@ -2,7 +2,7 @@ _: {
services.home-assistant.config = {
lovelace.mode = "yaml";
http = {
server_host = "0.0.0.0";
server_host = ["0.0.0.0"];
server_port = 8123;
};
homeassistant = {

20
hosts/yuki/topology.nix Normal file
View file

@ -0,0 +1,20 @@
_: {
topology = {
self = {
name = "yuki";
hardware.info = "Proxmox VM";
interfaces = {
tailscale0 = {
addresses = ["100.108.113.89/32"];
network = "tailscale0";
type = "wireguard";
};
home = {
addresses = ["192.168.1.98/24"];
network = "home";
type = "ethernet";
};
};
};
};
}

View file

@ -1,13 +1,6 @@
_: {
imports = [
./prometheus.nix
./security.nix
./users.nix
./nix.nix
./system.nix
./openssh.nix
./virtualisation.nix
./sops.nix
./time.nix
./pre-commit.nix
./topology.nix
];
}

27
modules/pre-commit.nix Normal file
View file

@ -0,0 +1,27 @@
{inputs, ...}: {
imports = [
inputs.pre-commit-hooks.flakeModule
];
perSystem.pre-commit = {
check.enable = true;
settings = {
excludes = ["flake.lock"];
hooks = {
stylua.enable = true;
statix.enable = true;
alejandra.enable = true;
deadnix = {
enable = true;
excludes = ["technorino.nix"];
};
prettier = {
enable = true;
files = "\\.(js|ts|md|json)$";
settings = {
trailing-comma = "none";
};
};
};
};
};
}

85
modules/topology.nix Normal file
View file

@ -0,0 +1,85 @@
{
inputs,
self,
...
}: {
imports = [
inputs.nix-topology.flakeModule
];
perSystem = _: {
topology.modules = [
{inherit (self) nixosConfigurations;}
({config, ...}: let
inherit
(config.lib.topology)
mkConnection
mkInternet
mkRouter
;
in {
networks = {
home = {
name = "home";
cidrv4 = "192.168.0.0/24";
};
tailscale0 = {
name = "tailscale";
cidrv4 = "100.0.0.0/32";
};
hetzner = {
name = "hetzner";
cidrv4 = "5.161.102.107/24";
};
};
nodes = {
internet = mkInternet {
connections = [
(mkConnection "hetzner" "wan0")
(mkConnection "router" "lan0")
];
};
router = mkRouter "UDM-SE" {
info = "UDM-SE";
interfaceGroups = [
[
"eth0"
"eth1"
"eth2"
"eth4"
"eth5"
"eth6"
"eth7"
]
["lan0"]
];
connections = {
eth0 = mkConnection "ame" "home";
eth1 = mkConnection "arashi" "home";
eth2 = mkConnection "haru" "home";
eth3 = mkConnection "kariru" "home";
eth4 = mkConnection "sakura" "home";
eth5 = mkConnection "tsuki" "home";
eth6 = mkConnection "tsuru" "home";
eth7 = mkConnection "yuki" "home";
};
};
hetzner = mkRouter "Hetzner" {
info = "hetzner edge router";
interfaceGroups = [
[
"eth0"
"eth1"
]
["wan0"]
];
connections = {
eth0 = mkConnection "sora" "eth0";
eth1 = mkConnection "kaze" "eth0";
};
};
};
})
];
};
}