formatting

This commit is contained in:
mjallen18
2024-05-31 16:11:42 -05:00
parent 4aead74c7f
commit 29ec754b2f
82 changed files with 1521 additions and 974 deletions

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.collabora;
in {
let
cfg = config.nas-apps.collabora;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.collabora = {
enable = mkEnableOption "collabora docker service";
@@ -37,6 +38,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,13 +1,23 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.deluge;
in {
let
cfg = config.nas-apps.deluge;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
systemd.services.deluge-docker = {
path = [ pkgs.bash pkgs.docker ];
path = [
pkgs.bash
pkgs.docker
];
script = ''
set -e
exec docker run \

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.deluge = {
enable = mkEnableOption "deluge docker service";
@@ -47,6 +48,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,8 +1,13 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
with lib;
let
let
cfg = config.apps.discover-wrapped;
# discover-wrapper is needed as of 1/24/24 since PackageKit does not work correctly so this removes error messages.
discover-wrapped = pkgs.symlinkJoin {
name = "discover-flatpak-backend";
@@ -15,7 +20,7 @@ let
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
# Configure environment
environment.systemPackages = [ discover-wrapped ];

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.apps.discover-wrapped = {
enable = mkEnableOption "enable discover with flatpak";
};

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.homarr;
in {
let
cfg = config.nas-apps.homarr;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
@@ -15,7 +22,7 @@ in {
"${cfg.configPath}/data:/data"
"/var/run/docker.sock:/var/run/docker.sock"
"/var/run/podman/podman.sock:/var/run/podman.sock"
];
];
environment = {
# PUID = cfg.puid;
# PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.homarr = {
enable = mkEnableOption "homarr docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.homepage;
in {
let
cfg = config.nas-apps.homepage;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
@@ -13,7 +20,7 @@ in {
"${cfg.configPath}:/app/config"
"/var/run/docker.sock:/var/run/docker.sock"
"/var/run/podman/podman.sock:/var/run/podman.sock"
];
];
environment = {
# PUID = cfg.puid;
# PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.homepage = {
enable = mkEnableOption "homepage docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.jackett;
in {
let
cfg = config.nas-apps.jackett;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.jackett = {
enable = mkEnableOption "jackett docker service";

View File

@@ -1,54 +1,35 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.jellyfin;
in {
let
cfg = config.nas-apps.jellyfin;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
# systemd.services.jellyfin-nvidia-docker = {
# path = [ pkgs.bash pkgs.docker ];
# script = ''
# set -e
# exec sudo docker run \
# --rm \
# --gpus all \
# --runtime=nvidia \
# --name=${cfg.name} \
# -e PUID=${cfg.puid} \
# -e PGID=${cfg.pgid} \
# -e TZ=${cfg.timeZone} \
# -e 'NVIDIA_DRIVER_CAPABILITIES'='all' \
# -e 'NVIDIA_VISIBLE_DEVICES'='all' \
# -p ${cfg.port}:8096 \
# -v '${cfg.configPath}:/config' \
# -v '${cfg.moviesPath}:/data/movies' \
# -v '${cfg.tvPath}:/data/tv' \
# ${cfg.image}:latest
# '';
# wantedBy = [ "multi-user.target" ];
# };
# };
# }
# nix-docker
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=nvidia.com/gpu=0" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/data/movies"
"${cfg.tvPath}:/data/tv"
];
ports = [ "${cfg.port}:8096" ];
environment = {
NVIDIA_VISIBLE_DEVICES = "all";
NVIDIA_DRIVER_CAPABILITIES = "all";
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=nvidia.com/gpu=0" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/data/movies"
"${cfg.tvPath}:/data/tv"
];
ports = [ "${cfg.port}:8096" ];
environment = {
NVIDIA_VISIBLE_DEVICES = "all";
NVIDIA_DRIVER_CAPABILITIES = "all";
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
};
}

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.jellyfin = {
enable = mkEnableOption "jellyfin docker service";
@@ -52,6 +53,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.jellyseerr;
in {
let
cfg = config.nas-apps.jellyseerr;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.jellyseerr = {
enable = mkEnableOption "jellyseerr docker service";
@@ -42,6 +43,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.mariadb;
in {
let
cfg = config.nas-apps.mariadb;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.mariadb = {
enable = mkEnableOption "mariadb docker service";

View File

@@ -1,15 +1,28 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.nextcloud;
in {
let
cfg = config.nas-apps.nextcloud;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.httpPort}:80" "${cfg.httpsPort}:443" ];
volumes = [ "${cfg.configPath}:/config" "${cfg.dataPath}:/data" ];
ports = [
"${cfg.httpPort}:80"
"${cfg.httpsPort}:443"
];
volumes = [
"${cfg.configPath}:/config"
"${cfg.dataPath}:/data"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.nextcloud = {
enable = mkEnableOption "nextcloud docker service";

View File

@@ -1,13 +1,23 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.ollama;
in {
let
cfg = config.nas-apps.ollama;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
systemd.services.ollama-docker = {
path = [ pkgs.bash pkgs.docker ];
path = [
pkgs.bash
pkgs.docker
];
script = ''
set -e
exec docker run \

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.ollama = {
enable = mkEnableOption "ollama docker service";
@@ -42,6 +43,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,33 +1,34 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.open-webui;
in {
let
cfg = config.nas-apps.open-webui;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
systemd.services.open-webui-docker = {
path = [ pkgs.bash pkgs.docker ];
script = ''
set -e
exec docker run \
--rm \
--gpus all \
--runtime=nvidia \
--name=${cfg.name} \
-e PUID=${cfg.puid} \
-e PGID=${cfg.pgid} \
-e TZ=${cfg.timeZone} \
-e 'NVIDIA_DRIVER_CAPABILITIES'='all' \
-e 'NVIDIA_VISIBLE_DEVICES'='all' \
-p ${cfg.port}:8080 \
-v '${cfg.configPath}:/app/backend/data' \
-v '/mnt/ssd/nix-app-data/ollama:/root/.ollama' \
${cfg.image}
'';
wantedBy = [ "multi-user.target" ];
virtualisation.oci-containers.containers.${cfg.name} = {
autoStart = true;
image = cfg.image;
extraOptions = [ "--device=nvidia.com/gpu=0" ];
volumes = [
"${cfg.configPath}:/app/backend/data"
"${cfg.ollamaPath}:/root/.ollama"
];
ports = [ "${cfg.port}:8080" ];
environment = {
NVIDIA_VISIBLE_DEVICES = "all";
NVIDIA_DRIVER_CAPABILITIES = "all";
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}
# --add-host=host.docker.internal:host-gateway \
# -e 'OLLAMA_BASE_URL'='http://10.0.1.18:11434' \

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.open-webui = {
enable = mkEnableOption "open-webui docker service";
@@ -42,6 +43,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,14 +1,24 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.orca-slicer;
in {
let
cfg = config.nas-apps.orca-slicer;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.httpPort}:3000" "${cfg.httpsPort}:3001" ];
ports = [
"${cfg.httpPort}:3000"
"${cfg.httpsPort}:3001"
];
volumes = [ "${cfg.configPath}:/config" ];
environment = {
PUID = cfg.puid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.orca-slicer = {
enable = mkEnableOption "orca slicer docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.radarr;
in {
let
cfg = config.nas-apps.radarr;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.radarr = {
enable = mkEnableOption "radarr docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.sabnzbd;
in {
let
cfg = config.nas-apps.sabnzbd;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.sabnzbd = {
enable = mkEnableOption "sabnzbd docker service";
@@ -62,6 +63,5 @@ with lib; {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.sonarr;
in {
let
cfg = config.nas-apps.sonarr;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.sonarr = {
enable = mkEnableOption "sonarr docker service";

View File

@@ -1,20 +1,39 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.swag;
in {
let
cfg = config.nas-apps.swag;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
networking.firewall = {
allowedTCPPorts = [ cfg.httpPort cfg.httpsPort 81 ];
allowedUDPPorts = [ cfg.httpPort cfg.httpsPort 81 ];
allowedTCPPorts = [
cfg.httpPort
cfg.httpsPort
81
];
allowedUDPPorts = [
cfg.httpPort
cfg.httpsPort
81
];
};
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${toString cfg.httpPort}:80" "${toString cfg.httpsPort}:443" "81:81" ];
ports = [
"${toString cfg.httpPort}:80"
"${toString cfg.httpsPort}:443"
"81:81"
];
volumes = [ "${cfg.configPath}:/config" ];
environment = {
PUID = cfg.puid;
@@ -24,7 +43,7 @@ in {
URL = cfg.url;
VALIDATION = cfg.validation;
SUBDOMAINS = cfg.subdomains;
DOCKER_MODS="linuxserver/mods:swag-dashboard";
DOCKER_MODS = "linuxserver/mods:swag-dashboard";
};
};
};

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.swag = {
enable = mkEnableOption "swag docker service";

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-apps.vscode;
in {
let
cfg = config.nas-apps.vscode;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
@@ -9,11 +16,11 @@ in {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.port}:8443" ];
volumes = [
volumes = [
"${cfg.configPath}:/config"
"/mnt/ssd/ssd_app_data:/ssd_app_data"
"/home/admin/nix-config:/nix-config"
];
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-apps.vscode = {
enable = mkEnableOption "vscode docker service";

View File

@@ -1,4 +1,5 @@
{ ... }: {
{ ... }:
{
imports = [
./samba
./apps/collabora

View File

@@ -1,7 +1,14 @@
{ lib, pkgs, config, ... }:
{
lib,
pkgs,
config,
...
}:
with lib;
let cfg = config.nas-samba;
in {
let
cfg = config.nas-samba;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
@@ -39,24 +46,27 @@ in {
guest account = nobody
map to guest = bad user
'';
shares = let
make = name: share:
nameValuePair "${name}" {
path = share.sharePath;
public = if share.enableTimeMachine then "no" else "yes";
private = if !share.public || share.enableTimeMachine then "yes" else "no";
browseable = if share.browseable then "yes" else "no";
writable = "yes";
"read only" = if share.readOnly then "yes" else "no";
"guest ok" = if share.guestOk then "yes" else "no";
"create mask" = share.createMask;
"directory mask" = share.directoryMask;
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no";
"vfs objects" = "catia fruit streams_xattr";
"fruit:time machine max size" = share.timeMachineMaxSize;
};
in mapAttrs' make cfg.shares;
shares =
let
make =
name: share:
nameValuePair "${name}" {
path = share.sharePath;
public = if share.enableTimeMachine then "no" else "yes";
private = if !share.public || share.enableTimeMachine then "yes" else "no";
browseable = if share.browseable then "yes" else "no";
writable = "yes";
"read only" = if share.readOnly then "yes" else "no";
"guest ok" = if share.guestOk then "yes" else "no";
"create mask" = share.createMask;
"directory mask" = share.directoryMask;
"fruit:aapl" = if share.enableTimeMachine then "yes" else "no";
"fruit:time machine" = if share.enableTimeMachine then "yes" else "no";
"vfs objects" = "catia fruit streams_xattr";
"fruit:time machine max size" = share.timeMachineMaxSize;
};
in
mapAttrs' make cfg.shares;
};
};
}

View File

@@ -1,5 +1,6 @@
{ lib, ... }:
with lib; {
with lib;
{
options.nas-samba = {
enable = mkEnableOption "nas samba service";
@@ -21,46 +22,48 @@ with lib; {
};
shares = mkOption {
type = types.attrsOf (types.submodule {
options = {
public = mkOption {
type = types.bool;
default = false;
type = types.attrsOf (
types.submodule {
options = {
public = mkOption {
type = types.bool;
default = false;
};
sharePath = mkOption {
type = types.str;
default = "";
};
readOnly = mkOption {
type = types.bool;
default = false;
};
browseable = mkOption {
type = types.bool;
default = true;
};
guestOk = mkOption {
type = types.bool;
default = true;
};
createMask = mkOption {
type = types.str;
default = "0774";
};
directoryMask = mkOption {
type = types.str;
default = "0775";
};
enableTimeMachine = mkOption {
type = types.bool;
default = false;
};
timeMachineMaxSize = mkOption {
type = types.str;
default = "0K";
};
};
sharePath = mkOption {
type = types.str;
default = "";
};
readOnly = mkOption {
type = types.bool;
default = false;
};
browseable = mkOption {
type = types.bool;
default = true;
};
guestOk = mkOption {
type = types.bool;
default = true;
};
createMask = mkOption {
type = types.str;
default = "0774";
};
directoryMask = mkOption {
type = types.str;
default = "0775";
};
enableTimeMachine = mkOption {
type = types.bool;
default = false;
};
timeMachineMaxSize = mkOption {
type = types.str;
default = "0K";
};
};
});
}
);
default = { };
};
};