Simplify nixedo modules

This commit is contained in:
Oliver Davies 2025-04-19 11:45:23 +01:00
parent 791d206764
commit 828985d76f
6 changed files with 102 additions and 154 deletions

View file

@ -29,14 +29,6 @@
./modules/paperless.nix
];
nixosModules = {
audiobookshelf.enable = true;
immich.enable = true;
jellyfin.enable = true;
paperless.enable = true;
pihole.enable = true;
};
programs.dconf.enable = true;
services.logind.lidSwitchExternalPower = "ignore";

View file

@ -1,14 +1,6 @@
{ config, lib, ... }:
{ config, ... }:
with lib;
let
cfg = config.nixosModules.audiobookshelf;
in
{
options.nixosModules.audiobookshelf.enable = mkEnableOption "Enable audiobookshelf";
config = mkIf cfg.enable {
services = {
audiobookshelf = {
enable = true;
@ -22,5 +14,4 @@ in
extraConfig = "reverse_proxy localhost:${toString config.services.audiobookshelf.port}";
};
};
};
}

View file

@ -1,19 +1,9 @@
{
config,
pkgs,
lib,
...
}:
with lib;
{ pkgs, lib, ... }:
let
port = 8082;
in
{
options.nixosModules.pihole.enable = mkEnableOption "Enable pihole";
config = mkIf config.nixosModules.pihole.enable {
virtualisation = {
docker = {
enable = true;
@ -97,5 +87,4 @@ in
wantedBy = [ "multi-user.target" ];
};
};
};
}

View file

@ -1,28 +1,19 @@
{
config,
lib,
pkgs,
...
}:
with lib;
{ config, pkgs, ... }:
{
options.nixosModules.immich.enable = mkEnableOption "Enable immich";
config = mkIf config.nixosModules.immich.enable {
services.immich = {
services = {
immich = {
enable = true;
group = "media";
mediaLocation = "/mnt/media/immich";
};
environment.systemPackages = [ pkgs.immich-cli ];
services.caddy.virtualHosts."immich.oliverdavies.uk" = {
caddy.virtualHosts."immich.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = "reverse_proxy localhost:${toString config.services.immich.port}";
};
};
environment.systemPackages = [ pkgs.immich-cli ];
}

View file

@ -1,19 +1,13 @@
{ config, lib, ... }:
with lib;
{
options.nixosModules.jellyfin.enable = mkEnableOption "Enable jellyfin";
config = mkIf config.nixosModules.jellyfin.enable {
services.jellyfin = {
services = {
jellyfin = {
enable = true;
openFirewall = true;
group = "media";
configDir = "/mnt/media/jellyfin";
};
services.caddy.virtualHosts."jellyfin.oliverdavies.uk" = {
caddy.virtualHosts."jellyfin.oliverdavies.uk" = {
useACMEHost = "oliverdavies.uk";
extraConfig = "reverse_proxy localhost:8096";

View file

@ -1,14 +1,6 @@
{ config, lib, ... }:
{ config, ... }:
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;
@ -16,15 +8,14 @@ in
dataDir = "/mnt/media/paperless";
settings = {
PAPERLESS_URL = "https://${url}";
PAPERLESS_URL = "https://paperless.oliverdavies.uk";
};
};
caddy.virtualHosts."${url}" = {
caddy.virtualHosts."${config.services.paperless.settings.PAPERLESS_URL}" = {
useACMEHost = "oliverdavies.uk";
extraConfig = "reverse_proxy localhost:28981";
};
};
};
}