feat: added per service enable options for impermanence configs
This commit is contained in:
parent
a8af8930fa
commit
89793fca6a
15 changed files with 120 additions and 15 deletions
|
|
@ -6,7 +6,14 @@
|
||||||
const = import ./const.nix;
|
const = import ./const.nix;
|
||||||
dataDirectory = const.dataDirectory;
|
dataDirectory = const.dataDirectory;
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.actual.enable && config.host.impermanence.enable) {
|
options.services.actual = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.actual.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.actual.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.actual.settings.ACTUAL_DATA_DIR == dataDirectory;
|
assertion = config.services.actual.settings.ACTUAL_DATA_DIR == dataDirectory;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
bazarr_data_directory = "/var/lib/bazarr";
|
bazarr_data_directory = "/var/lib/bazarr";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.bazarr.enable && config.host.impermanence.enable) {
|
options.services.bazarr = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.bazarr.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.bazarr.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.bazarr.dataDir == bazarr_data_directory;
|
assertion = config.services.bazarr.dataDir == bazarr_data_directory;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
workingDirectory = "/var/lib/private/crab-hole";
|
workingDirectory = "/var/lib/private/crab-hole";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.crab-hole.enable && config.host.impermanence.enable) {
|
options.services.crab-hole = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.crab-hole.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.crab-hole.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion =
|
assertion =
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,14 @@
|
||||||
dataFolder = "/var/lib/fail2ban";
|
dataFolder = "/var/lib/fail2ban";
|
||||||
dataFile = "fail2ban.sqlite3";
|
dataFile = "fail2ban.sqlite3";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.fail2ban.enable && config.host.impermanence.enable) {
|
options.services.fail2ban = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.fail2ban.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.fail2ban.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.fail2ban.daemonSettings.Definition.dbfile == "${dataFolder}/${dataFile}";
|
assertion = config.services.fail2ban.daemonSettings.Definition.dbfile == "${dataFolder}/${dataFile}";
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,14 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = lib.mkIf (config.services.flaresolverr.enable && config.host.impermanence.enable) {
|
options.services.flaresolverr = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.flaresolverr.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.flaresolverr.impermanence.enable {
|
||||||
# FlareSolverr typically doesn't need persistent storage as it's a proxy service
|
# FlareSolverr typically doesn't need persistent storage as it's a proxy service
|
||||||
# but we'll add basic structure in case it's needed for logs or configuration
|
# but we'll add basic structure in case it's needed for logs or configuration
|
||||||
environment.persistence."/persist/system/root" = {
|
environment.persistence."/persist/system/root" = {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
stateDir = "/var/lib/forgejo";
|
stateDir = "/var/lib/forgejo";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.forgejo.enable && config.host.impermanence.enable) {
|
options.services.forgejo = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.forgejo.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.forgejo.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.forgejo.stateDir == stateDir;
|
assertion = config.services.forgejo.stateDir == stateDir;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
mediaLocation = "/var/lib/immich";
|
mediaLocation = "/var/lib/immich";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.immich.enable && config.host.impermanence.enable) {
|
options.services.immich = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.immich.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.immich.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.immich.mediaLocation == mediaLocation;
|
assertion = config.services.immich.mediaLocation == mediaLocation;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
jackett_data_directory = "/var/lib/jackett/.config/Jackett";
|
jackett_data_directory = "/var/lib/jackett/.config/Jackett";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.jackett.enable && config.host.impermanence.enable) {
|
options.services.jackett = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.jackett.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.jackett.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.jackett.dataDir == jackett_data_directory;
|
assertion = config.services.jackett.dataDir == jackett_data_directory;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,14 @@
|
||||||
jellyfin_data_directory = "/var/lib/jellyfin";
|
jellyfin_data_directory = "/var/lib/jellyfin";
|
||||||
jellyfin_cache_directory = "/var/cache/jellyfin";
|
jellyfin_cache_directory = "/var/cache/jellyfin";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.jellyfin.enable && config.host.impermanence.enable) {
|
options.services.jellyfin = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.jellyfin.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.jellyfin.impermanence.enable {
|
||||||
fileSystems."/persist/system/jellyfin".neededForBoot = true;
|
fileSystems."/persist/system/jellyfin".neededForBoot = true;
|
||||||
|
|
||||||
host.storage.pool.extraDatasets = {
|
host.storage.pool.extraDatasets = {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
lidarr_data_directory = "/var/lib/lidarr/.config/Lidarr";
|
lidarr_data_directory = "/var/lib/lidarr/.config/Lidarr";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.lidarr.enable && config.host.impermanence.enable) {
|
options.services.lidarr = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.lidarr.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.lidarr.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.lidarr.dataDir == lidarr_data_directory;
|
assertion = config.services.lidarr.dataDir == lidarr_data_directory;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,14 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = lib.mkIf (config.services.panoramax.enable && config.host.impermanence.enable) {
|
options.services.panoramax = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.panoramax.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.panoramax.impermanence.enable {
|
||||||
# TODO: configure impermanence for panoramax data
|
# TODO: configure impermanence for panoramax data
|
||||||
# This would typically include directories like:
|
# This would typically include directories like:
|
||||||
# - /var/lib/panoramax
|
# - /var/lib/panoramax
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
dataDir = "/var/lib/paperless";
|
dataDir = "/var/lib/paperless";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.paperless.enable && config.host.impermanence.enable) {
|
options.services.paperless = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.paperless.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.paperless.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.paperless.dataDir == dataDir;
|
assertion = config.services.paperless.dataDir == dataDir;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
qbittorent_profile_directory = "/var/lib/qBittorrent/";
|
qbittorent_profile_directory = "/var/lib/qBittorrent/";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.qbittorrent.enable && config.host.impermanence.enable) {
|
options.services.qbittorrent = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.qbittorrent.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.qbittorrent.impermanence.enable {
|
||||||
fileSystems."/persist/system/qbittorrent".neededForBoot = true;
|
fileSystems."/persist/system/qbittorrent".neededForBoot = true;
|
||||||
|
|
||||||
host.storage.pool.extraDatasets = {
|
host.storage.pool.extraDatasets = {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
radarr_data_directory = "/var/lib/radarr/.config/Radarr";
|
radarr_data_directory = "/var/lib/radarr/.config/Radarr";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.radarr.enable && config.host.impermanence.enable) {
|
options.services.radarr = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.radarr.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.radarr.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.radarr.dataDir == radarr_data_directory;
|
assertion = config.services.radarr.dataDir == radarr_data_directory;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,14 @@
|
||||||
}: let
|
}: let
|
||||||
sonarr_data_directory = "/var/lib/sonarr/.config/NzbDrone";
|
sonarr_data_directory = "/var/lib/sonarr/.config/NzbDrone";
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.services.sonarr.enable && config.host.impermanence.enable) {
|
options.services.sonarr = {
|
||||||
|
impermanence.enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = config.services.sonarr.enable && config.host.impermanence.enable;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.sonarr.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = config.services.sonarr.dataDir == sonarr_data_directory;
|
assertion = config.services.sonarr.dataDir == sonarr_data_directory;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue