Move homelab modules
This commit is contained in:
parent
2af364ef96
commit
42b70676bc
10 changed files with 6 additions and 20 deletions
26
hosts/nixedo/modules/audiobookshelf.nix
Normal file
26
hosts/nixedo/modules/audiobookshelf.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.nixosModules.audiobookshelf;
|
||||
in
|
||||
{
|
||||
options.nixosModules.audiobookshelf.enable = mkEnableOption "Enable audiobookshelf";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services = {
|
||||
audiobookshelf = {
|
||||
enable = true;
|
||||
|
||||
port = 4001;
|
||||
};
|
||||
|
||||
caddy.virtualHosts."audiobookshelf.oliverdavies.uk" = {
|
||||
useACMEHost = "oliverdavies.uk";
|
||||
|
||||
extraConfig = "reverse_proxy localhost:${toString config.services.audiobookshelf.port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
101
hosts/nixedo/modules/containers/pi-hole.nix
Normal file
101
hosts/nixedo/modules/containers/pi-hole.nix
Normal file
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
port = 8082;
|
||||
in
|
||||
{
|
||||
options.nixosModules.pihole.enable = mkEnableOption "Enable pihole";
|
||||
|
||||
config = mkIf config.nixosModules.pihole.enable {
|
||||
virtualisation = {
|
||||
docker = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
|
||||
oci-containers = {
|
||||
backend = "docker";
|
||||
|
||||
containers."pihole" = {
|
||||
image = "pihole/pihole:latest";
|
||||
|
||||
environment = {
|
||||
"PIHOLE_DNS_1" = "8.8.8.8";
|
||||
"PIHOLE_DNS_2" = "8.8.4.4";
|
||||
"TZ" = "Europe/London";
|
||||
};
|
||||
|
||||
volumes = [
|
||||
"/home/opdavies/pihole/etc-dnsmasq.d:/etc/dnsmasq.d:rw"
|
||||
"/home/opdavies/pihole/etc-pihole:/etc/pihole:rw"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"53:53/tcp"
|
||||
"53:53/udp"
|
||||
"67:67/udp"
|
||||
"${toString port}:80/tcp"
|
||||
];
|
||||
|
||||
log-driver = "journald";
|
||||
|
||||
extraOptions = [
|
||||
"--cap-add=NET_ADMIN"
|
||||
"--network-alias=pihole"
|
||||
"--network=pihole_default"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services = {
|
||||
"docker-pihole" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
RestartMaxDelaySec = lib.mkOverride 90 "1m";
|
||||
RestartSec = lib.mkOverride 90 "100ms";
|
||||
RestartSteps = lib.mkOverride 90 9;
|
||||
};
|
||||
|
||||
after = [ "docker-network-pihole_default.service" ];
|
||||
requires = [ "docker-network-pihole_default.service" ];
|
||||
partOf = [ "docker-compose-pihole-root.target" ];
|
||||
wantedBy = [ "docker-compose-pihole-root.target" ];
|
||||
};
|
||||
|
||||
"docker-network-pihole_default" = {
|
||||
path = [ pkgs.docker ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "docker network rm -f pihole_default";
|
||||
};
|
||||
|
||||
script = ''
|
||||
docker network inspect pihole_default || docker network create pihole_default
|
||||
'';
|
||||
|
||||
partOf = [ "docker-compose-pihole-root.target" ];
|
||||
wantedBy = [ "docker-compose-pihole-root.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
targets."docker-compose-pihole-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
34
hosts/nixedo/modules/forgejo.nix
Normal file
34
hosts/nixedo/modules/forgejo.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.nixosModules.forgejo.enable = mkEnableOption "Enable forgejo";
|
||||
|
||||
config = mkIf config.nixosModules.forgejo.enable {
|
||||
services = {
|
||||
forgejo = {
|
||||
enable = true;
|
||||
group = "media";
|
||||
stateDir = "/mnt/media/forgejo";
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
DOMAIN = "forgejo.oliverdavies.uk";
|
||||
HTTP_PORT = 2223;
|
||||
};
|
||||
|
||||
service = {
|
||||
DISABLE_REGISTRATION = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
caddy.virtualHosts."${config.services.forgejo.settings.server.DOMAIN}" = {
|
||||
useACMEHost = "oliverdavies.uk";
|
||||
|
||||
extraConfig = "reverse_proxy localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
28
hosts/nixedo/modules/immich.nix
Normal file
28
hosts/nixedo/modules/immich.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.nixosModules.immich.enable = mkEnableOption "Enable immich";
|
||||
|
||||
config = mkIf config.nixosModules.immich.enable {
|
||||
services.immich = {
|
||||
enable = true;
|
||||
group = "media";
|
||||
mediaLocation = "/mnt/media/immich";
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.immich-cli ];
|
||||
|
||||
services.caddy.virtualHosts."immich.oliverdavies.uk" = {
|
||||
useACMEHost = "oliverdavies.uk";
|
||||
|
||||
extraConfig = "reverse_proxy localhost:${toString config.services.immich.port}";
|
||||
};
|
||||
};
|
||||
}
|
22
hosts/nixedo/modules/jellyfin.nix
Normal file
22
hosts/nixedo/modules/jellyfin.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.nixosModules.jellyfin.enable = mkEnableOption "Enable jellyfin";
|
||||
|
||||
config = mkIf config.nixosModules.jellyfin.enable {
|
||||
services.jellyfin = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
group = "media";
|
||||
configDir = "/mnt/media/jellyfin";
|
||||
};
|
||||
|
||||
services.caddy.virtualHosts."jellyfin.oliverdavies.uk" = {
|
||||
useACMEHost = "oliverdavies.uk";
|
||||
|
||||
extraConfig = "reverse_proxy localhost:8096";
|
||||
};
|
||||
};
|
||||
}
|
30
hosts/nixedo/modules/paperless.nix
Normal file
30
hosts/nixedo/modules/paperless.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
url = "paperless.oliverdavies.uk";
|
||||
in
|
||||
{
|
||||
options.nixosModules.paperless.enable = mkEnableOption "Enable paperless";
|
||||
|
||||
config = mkIf config.nixosModules.paperless.enable {
|
||||
services = {
|
||||
paperless = {
|
||||
enable = true;
|
||||
|
||||
dataDir = "/mnt/media/paperless";
|
||||
|
||||
settings = {
|
||||
PAPERLESS_URL = "https://${url}";
|
||||
};
|
||||
};
|
||||
|
||||
caddy.virtualHosts."${url}" = {
|
||||
useACMEHost = "oliverdavies.uk";
|
||||
|
||||
extraConfig = "reverse_proxy localhost:28981";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue