Compare commits
2 commits
7d64b2b4a3
...
35bfc55356
Author | SHA1 | Date | |
---|---|---|---|
35bfc55356 | |||
95cbc98ee3 |
6 changed files with 56 additions and 35 deletions
|
@ -1 +1,2 @@
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILZKBTf7HdsZDJDwblnROAaGZDIWi/jWNwGjrih8UPuY kalle@kalle-laptop
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILZKBTf7HdsZDJDwblnROAaGZDIWi/jWNwGjrih8UPuY kalle@kalle-laptop
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPxzPYIYw3Ysv5LwzC2zSjE8kcycgZ/vm+r0iOt6+XI2 kalle@kalle-pc
|
||||||
|
|
|
@ -18,14 +18,17 @@
|
||||||
|
|
||||||
homelabConfig = import ./config.nix;
|
homelabConfig = import ./config.nix;
|
||||||
roles = import ./roles { inherit utils; };
|
roles = import ./roles { inherit utils; };
|
||||||
hosts = import ./hosts.nix { inherit homelabConfig roles; };
|
hosts = import ./hosts.nix {
|
||||||
|
inherit homelabConfig roles;
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = nixpkgs.lib.mapAttrs (
|
nixosConfigurations = nixpkgs.lib.mapAttrs (
|
||||||
hostname: value:
|
_: value:
|
||||||
(utils.mkSystem {
|
(utils.mkSystem {
|
||||||
inherit hosts;
|
inherit hosts;
|
||||||
hostConfig = (value // { inherit hostname; });
|
hostConfig = value;
|
||||||
})
|
})
|
||||||
) hosts;
|
) hosts;
|
||||||
};
|
};
|
||||||
|
|
45
hosts.nix
45
hosts.nix
|
@ -1,37 +1,20 @@
|
||||||
{
|
{
|
||||||
roles,
|
roles,
|
||||||
homelabConfig,
|
homelabConfig,
|
||||||
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
lib.attrsets.mapAttrs' (
|
||||||
hlConfig = homelabConfig;
|
name: _:
|
||||||
in
|
let
|
||||||
{
|
cfg = import (./hosts + "/${name}") {
|
||||||
base = {
|
inherit roles;
|
||||||
roles = [ ];
|
hlConfig = homelabConfig;
|
||||||
config = { };
|
|
||||||
stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-test = {
|
|
||||||
roles = with roles; [
|
|
||||||
traefik
|
|
||||||
sonarr
|
|
||||||
];
|
|
||||||
config = {
|
|
||||||
sonarr.domain = "sonarr2.${hlConfig.domain}";
|
|
||||||
traefik.wildcardDomains = [ hlConfig.domain ];
|
|
||||||
};
|
};
|
||||||
stateVersion = "24.05";
|
hostname = cfg.hostname;
|
||||||
};
|
in
|
||||||
|
{
|
||||||
nix-test2 = {
|
name = hostname;
|
||||||
roles = with roles; [
|
value = cfg;
|
||||||
sonarr
|
}
|
||||||
];
|
) (builtins.readDir ./hosts)
|
||||||
config = {
|
|
||||||
sonarr.domain = "sonarr.${hlConfig.domain}";
|
|
||||||
};
|
|
||||||
stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
15
hosts/base.nix
Normal file
15
hosts/base.nix
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
roles,
|
||||||
|
hlConfig,
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
hostname = "base";
|
||||||
|
managed = true;
|
||||||
|
ip = "192.168.10.98";
|
||||||
|
|
||||||
|
roles = with roles; [
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
};
|
||||||
|
stateVersion = "24.05";
|
||||||
|
}
|
19
hosts/nix-test.nix
Normal file
19
hosts/nix-test.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
roles,
|
||||||
|
hlConfig,
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
hostname = "nix-test";
|
||||||
|
managed = true;
|
||||||
|
ip = "192.168.10.99";
|
||||||
|
|
||||||
|
roles = with roles; [
|
||||||
|
traefik
|
||||||
|
sonarr
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
sonarr.domain = "sonarr2.${hlConfig.domain}";
|
||||||
|
traefik.wildcardDomains = [ hlConfig.domain ];
|
||||||
|
};
|
||||||
|
stateVersion = "24.05";
|
||||||
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
{
|
{
|
||||||
name = "${hostname}-sonarr";
|
name = "${hostname}-sonarr";
|
||||||
rule = "Host(`${config.sonarr.domain}`)";
|
rule = "Host(`${config.sonarr.domain}`)";
|
||||||
target = "http://${hostname}.lan:8989";
|
target = "http://${config.ip}:8989";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue