Compare commits
No commits in common. "bcec9a18c3243a920777683ddfd1eea768c3b510" and "102d6b3cbf7acd6cc906ed0cb2cca115fc87ff2f" have entirely different histories.
bcec9a18c3
...
102d6b3cbf
7 changed files with 11 additions and 107 deletions
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
domain = "staging.kallestruik.nl";
|
|
||||||
shortDomain = "khs.li";
|
|
||||||
}
|
|
11
flake.nix
11
flake.nix
|
@ -11,14 +11,11 @@
|
||||||
let
|
let
|
||||||
outputs = self.outputs;
|
outputs = self.outputs;
|
||||||
utils = import ./utils.nix { inherit nixpkgs inputs outputs; };
|
utils = import ./utils.nix { inherit nixpkgs inputs outputs; };
|
||||||
|
|
||||||
homelabConfig = import ./config.nix;
|
|
||||||
roles = import ./roles { inherit utils; };
|
|
||||||
hosts = import ./hosts.nix { inherit homelabConfig roles; };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = nixpkgs.lib.mapAttrs (
|
nixosConfigurations = {
|
||||||
hostname: value: (utils.mkSystem value // { inherit hostname; })
|
"base" = utils.mkSystem [ ];
|
||||||
) hosts;
|
"nix-test" = utils.mkSystem [ ./systems/nix-test.nix ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
25
hosts.nix
25
hosts.nix
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
roles,
|
|
||||||
homelabConfig,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
hlConfig = homelabConfig;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
base = {
|
|
||||||
roles = [ ];
|
|
||||||
config = { };
|
|
||||||
stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix-test = {
|
|
||||||
roles = with roles; [
|
|
||||||
sonarr
|
|
||||||
];
|
|
||||||
config = {
|
|
||||||
sonarr.domain = "sonarr.${hlConfig.domain}";
|
|
||||||
};
|
|
||||||
stateVersion = "24.05";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
utils,
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
sonarr = utils.mkRole (import ./sonarr.nix);
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
{
|
|
||||||
name = "Sonarr";
|
|
||||||
description = ''
|
|
||||||
Sonarr PVR
|
|
||||||
'';
|
|
||||||
|
|
||||||
traefikRoutes =
|
|
||||||
{
|
|
||||||
hostname,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name = "${hostname}-sonarr";
|
|
||||||
rule = "Host(`${config.sonarr.domain}`)";
|
|
||||||
target = "http://${hostname}.lan:8989";
|
|
||||||
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
nixosModules =
|
|
||||||
{ lib, ... }:
|
|
||||||
{
|
|
||||||
options.sonarr = {
|
|
||||||
domain = lib.mkOption {
|
|
||||||
type = lib.types.listOf lib.types.str;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
# Enable the sonarr service
|
|
||||||
services.sonarr = {
|
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
|
||||||
group = "media";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Ensure that the media group exists
|
|
||||||
users.groups.media = { };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -94,7 +94,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
global = {
|
global = {
|
||||||
fsid = "b9b22d11-3492-49a6-92b7-b36cdf0161fe";
|
fsid = "b9b22d11-3492-49a6-92b7-b36cdf0161fe";
|
||||||
monHost = "v2:192.168.10.3:3300/0,v1:192.168.10.3:6789/0";
|
monHost = "v2:192.168.1.239:3300/0,v1:192.168.1.239:6789/0";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
21
utils.nix
21
utils.nix
|
@ -6,30 +6,15 @@
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
mkSystem =
|
mkSystem =
|
||||||
hostConfig:
|
configs:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs outputs hostConfig;
|
inherit inputs outputs;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
inputs.impermanence.nixosModules.impermanence
|
inputs.impermanence.nixosModules.impermanence
|
||||||
# inputs.sops-nix.nixosModules.sops
|
|
||||||
|
|
||||||
./systems/base/configuration.nix
|
./systems/base/configuration.nix
|
||||||
(
|
] ++ configs;
|
||||||
{ ... }:
|
|
||||||
{
|
|
||||||
networking.hostName = hostConfig.hostname;
|
|
||||||
system.stateVersion = hostConfig.stateVersion;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
({ ... }: hostConfig.config)
|
|
||||||
] ++ builtins.map (role: role.nixosModule) hostConfig.roles;
|
|
||||||
};
|
|
||||||
|
|
||||||
mkRole = cfg: {
|
|
||||||
inherit (cfg) name description nixosModule;
|
|
||||||
traefikRoutes = cfg.traefikRoutes or ({ ... }: [ ]);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue