diff --git a/flake.lock b/flake.lock index 7c3d184..faa33da 100644 --- a/flake.lock +++ b/flake.lock @@ -23,14 +23,15 @@ "locked": { "lastModified": 1711742460, "narHash": "sha256-0O4v6e4a1toxXZ2gf5INhg4WPE5C5T+SVvsBt+45Mcc=", + "owner": "zhaofengli", + "repo": "attic", "rev": "4dbdbee45728d8ce5788db6461aaaa89d98081f0", - "revCount": 197, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/zhaofengli/attic/0.1.197%2Brev-4dbdbee45728d8ce5788db6461aaaa89d98081f0/018e8bce-1229-7d78-a052-5121272f0341/source.tar.gz" + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/zhaofengli/attic/0.1.%2A.tar.gz" + "owner": "zhaofengli", + "repo": "attic", + "type": "github" } }, "chaotic": { @@ -53,11 +54,11 @@ "yafas": "yafas" }, "locked": { - "lastModified": 1716816472, - "narHash": "sha256-u+Ub8IHGEIxj0gwpCXds4cWIc+hkTlRBL9RCBY/daNA=", + "lastModified": 1717161359, + "narHash": "sha256-OgbzieYV/ZvJn2Gj0Eqe5QMdl9DJEHhbsIjfP8w1KQs=", "owner": "chaotic-cx", "repo": "nyx", - "rev": "a6f43e450d97eece8757e6cb6136f4cd4f141a3b", + "rev": "5507ee42f38a2ba917a47d6964e56701317a0d21", "type": "github" }, "original": { @@ -133,11 +134,11 @@ "rocksdb": "rocksdb" }, "locked": { - "lastModified": 1716800097, - "narHash": "sha256-A8AXq7GqwLNOwCP6UyHzrusf2he6IYlD363/SrBKgts=", + "lastModified": 1716883613, + "narHash": "sha256-1fJyH76Pfx863Uk5jpPtpmyAIZcCk1luPD0cmPnhUNU=", "owner": "girlbossceo", "repo": "conduwuit", - "rev": "6ccf578437a42cf8f32a454ca99b78df23cfa4dc", + "rev": "f4cfc77a577e0dfd152878830294c8eb3fe47861", "type": "github" }, "original": { @@ -154,16 +155,17 @@ ] }, "locked": { - "lastModified": 1716745752, - "narHash": "sha256-8K1R9Yg4r08rYk86Yq+lu3E9L3uRUb4xMqYHgl0VGS0=", - "rev": "19ca94ec2d288de334ae932107816b4a97736cd8", - "revCount": 575, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.17.2/018fb607-1f2c-764b-bd8d-5ea0dd2a7665/source.tar.gz" + "lastModified": 1717025063, + "narHash": "sha256-dIubLa56W9sNNz0e8jGxrX3CAkPXsq7snuFA/Ie6dn8=", + "owner": "ipetkov", + "repo": "crane", + "rev": "480dff0be03dac0e51a8dfc26e882b0d123a450e", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/ipetkov/crane/%2A.tar.gz" + "owner": "ipetkov", + "repo": "crane", + "type": "github" } }, "crane_2": { @@ -249,16 +251,17 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1714544767, - "narHash": "sha256-kF1bX+YFMedf1g0PAJYwGUkzh22JmULtj8Rm4IXAQKs=", - "rev": "73124e1356bde9411b163d636b39fe4804b7ca45", - "revCount": 1852, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1852%2Brev-73124e1356bde9411b163d636b39fe4804b7ca45/018f333a-c195-795f-9e07-b43b47d5391f/source.tar.gz" + "lastModified": 1717136818, + "narHash": "sha256-BKFOT/eg0mCf99oTKa63yW+d5Y3K6c5Gb+NetxacaHg=", + "owner": "nix-community", + "repo": "fenix", + "rev": "14c3b99d4b7cb91343807eac77f005ed9218f742", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A.tar.gz" + "owner": "nix-community", + "repo": "fenix", + "type": "github" } }, "flake-compat": { @@ -266,14 +269,15 @@ "locked": { "lastModified": 1696426674, "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "revCount": 57, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/%2A.tar.gz" + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" } }, "flake-compat_2": { @@ -352,14 +356,15 @@ "locked": { "lastModified": 1710146030, "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "revCount": 92, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.92%2Brev-b1d9ab70662946ef0850d488da1c9019f3a9752a/018e2ca5-e5a2-7f80-9261-445a8cecd4d7/source.tar.gz" + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/numtide/flake-utils/0.1.%2A.tar.gz" + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } }, "flake-utils_2": { @@ -410,11 +415,11 @@ ] }, "locked": { - "lastModified": 1716736760, - "narHash": "sha256-h3RmnNknKYtVA+EvUSra6QAwfZjC2q1G8YA7W0gat8Y=", + "lastModified": 1717097707, + "narHash": "sha256-HC5vJ3oYsjwsCaSbkIPv80e4ebJpNvFKQTBOGlHvjLs=", "owner": "nix-community", "repo": "home-manager", - "rev": "5d151429e1e79107acf6d06dcc5ace4e642ec239", + "rev": "0eb314b4f0ba337e88123e0b1e57ef58346aafd9", "type": "github" }, "original": { @@ -451,11 +456,11 @@ ] }, "locked": { - "lastModified": 1716930911, - "narHash": "sha256-t4HT5j3Jy7skRB5PINnxcEBCkgE89rGBpwTI7YS4Ffo=", + "lastModified": 1717097707, + "narHash": "sha256-HC5vJ3oYsjwsCaSbkIPv80e4ebJpNvFKQTBOGlHvjLs=", "owner": "nix-community", "repo": "home-manager", - "rev": "a9b36cbe9292a649222b89fdb9ae9907e9c74086", + "rev": "0eb314b4f0ba337e88123e0b1e57ef58346aafd9", "type": "github" }, "original": { @@ -488,11 +493,11 @@ ] }, "locked": { - "lastModified": 1716618639, - "narHash": "sha256-H3kcJDVqDmXZ9IfVtqObL3JUx/a0ERn6gWBTn+7vwN4=", + "lastModified": 1717012808, + "narHash": "sha256-Wn0fbjqmpIiuPUWnvxu85a9sPYtSd/2tcPDhAYW54RM=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "a358c56a163b3b7d149571e853a8f75b2c1ceb38", + "rev": "a8e6557f29fa0cbcc2c54d15f9664c14ae2a3e98", "type": "github" }, "original": { @@ -514,11 +519,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1716773713, - "narHash": "sha256-++tmVuLwprXWSSq9AmfcZ4MjorMueuO5ThwuTzhp5SE=", + "lastModified": 1717118858, + "narHash": "sha256-zHqicvUQzBbR3/NlII54Yem/mC5sR5gdE1TN0MamR4M=", "owner": "martinvonz", "repo": "jj", - "rev": "a075a5c6cabd493759fc973d99d3fd88feb74735", + "rev": "404f31cbc1fa2f603e83630fe1229d88a9694569", "type": "github" }, "original": { @@ -638,11 +643,11 @@ ] }, "locked": { - "lastModified": 1716744562, - "narHash": "sha256-th1cXNfqbNstk6LNC2siouLQP5N4Ur69iV3idlKj8iE=", + "lastModified": 1716990063, + "narHash": "sha256-0Vv125wrFCJgSUSQRqhuHQOopWbOc8ICVeY/d2wAjOg=", "owner": "YaLTeR", "repo": "niri", - "rev": "ae7fb4c4f405aa0ff49930040d414581a812d938", + "rev": "c8e46b9d172dfa2ca89d82b87055b8e39622f80c", "type": "github" }, "original": { @@ -780,16 +785,18 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716509168, - "narHash": "sha256-4zSIhSRRIoEBwjbPm3YiGtbd8HDWzFxJjw5DYSDy1n8=", - "rev": "bfb7a882678e518398ce9a31a881538679f6f092", - "revCount": 630835, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.630835%2Brev-bfb7a882678e518398ce9a31a881538679f6f092/018fafb0-ec0d-7254-8082-b09ecc86e5fc/source.tar.gz" + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs-stable": { @@ -826,11 +833,11 @@ }, "nixpkgs-stable_3": { "locked": { - "lastModified": 1716633019, - "narHash": "sha256-xim1b5/HZYbWaZKyI7cn9TJCM6ewNVZnesRr00mXeS4=", + "lastModified": 1716991068, + "narHash": "sha256-Av0UWCCiIGJxsZ6TFc+OiKCJNqwoxMNVYDBChmhjNpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9d29cd266cebf80234c98dd0b87256b6be0af44e", + "rev": "25cf937a30bf0801447f6bf544fc7486c6309234", "type": "github" }, "original": { @@ -842,11 +849,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1716769173, - "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=", + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9ca3f649614213b2aaf5f1e16ec06952fe4c2632", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", "type": "github" }, "original": { @@ -903,11 +910,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1716769173, - "narHash": "sha256-7EXDb5WBw+d004Agt+JHC/Oyh/KTUglOaQ4MNjBbo5w=", + "lastModified": 1716948383, + "narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9ca3f649614213b2aaf5f1e16ec06952fe4c2632", + "rev": "ad57eef4ef0659193044870c731987a6df5cf56b", "type": "github" }, "original": { @@ -1257,14 +1264,15 @@ "locked": { "lastModified": 1695926485, "narHash": "sha256-wNFFnItckgSs8XeYhhv8vlJs2WF09fSQaWgw4xkDqHQ=", + "owner": "UbiqueLambda", + "repo": "yafas", "rev": "7772afd6686458ca0ddbc599a52cf5d337367653", - "revCount": 4, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/UbiqueLambda/yafas/0.1.4%2Brev-7772afd6686458ca0ddbc599a52cf5d337367653/018add18-ebb4-72c6-93fe-d1d8da361703/source.tar.gz" + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/UbiqueLambda/yafas/0.1.%2A.tar.gz" + "owner": "UbiqueLambda", + "repo": "yafas", + "type": "github" } } }, diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index af8338f..6e1cf01 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -58,6 +58,11 @@ in { httpsPort = "9443"; }; +# ollama.enable = true; + + open-webui.enable = true; +# open-webui.port = "3000"; + orca-slicer.enable = true; vscode.enable = true; diff --git a/modules/apps/ollama/default.nix b/modules/apps/ollama/default.nix new file mode 100644 index 0000000..f9a9906 --- /dev/null +++ b/modules/apps/ollama/default.nix @@ -0,0 +1,30 @@ +{ lib, pkgs, config, ... }: +with lib; +let cfg = config.nas-apps.ollama; +in { + imports = [ ./options.nix ]; + + config = mkIf cfg.enable { + + systemd.services.ollama-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}:11434 \ + -v '${cfg.configPath}:/root/.ollama' \ + ${cfg.image}:latest + ''; + wantedBy = [ "multi-user.target" ]; + }; + }; +} diff --git a/modules/apps/ollama/options.nix b/modules/apps/ollama/options.nix new file mode 100644 index 0000000..b36de92 --- /dev/null +++ b/modules/apps/ollama/options.nix @@ -0,0 +1,47 @@ +{ lib, ... }: +with lib; { + options.nas-apps.ollama = { + enable = mkEnableOption "ollama docker service"; + + autoStart = mkOption { + type = types.bool; + default = true; + }; + + port = mkOption { + type = types.str; + default = "11434"; + }; + + name = mkOption { + type = types.str; + default = "ollama"; + }; + + image = mkOption { + type = types.str; + default = "ollama/ollama"; + }; + + configPath = mkOption { + type = types.str; + default = "/mnt/ssd/nix-app-data/ollama"; + }; + + puid = mkOption { + type = types.str; + default = "911"; + }; + + pgid = mkOption { + type = types.str; + default = "1000"; + }; + + timeZone = mkOption { + type = types.str; + default = "America/Chicago"; + }; + + }; +} diff --git a/modules/apps/open-webui/default.nix b/modules/apps/open-webui/default.nix new file mode 100644 index 0000000..191542a --- /dev/null +++ b/modules/apps/open-webui/default.nix @@ -0,0 +1,33 @@ +{ lib, pkgs, config, ... }: +with lib; +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" ]; + }; + }; +} +# --add-host=host.docker.internal:host-gateway \ +# -e 'OLLAMA_BASE_URL'='http://10.0.1.18:11434' \ diff --git a/modules/apps/open-webui/options.nix b/modules/apps/open-webui/options.nix new file mode 100644 index 0000000..8d5e095 --- /dev/null +++ b/modules/apps/open-webui/options.nix @@ -0,0 +1,47 @@ +{ lib, ... }: +with lib; { + options.nas-apps.open-webui = { + enable = mkEnableOption "open-webui docker service"; + + autoStart = mkOption { + type = types.bool; + default = true; + }; + + port = mkOption { + type = types.str; + default = "8888"; + }; + + name = mkOption { + type = types.str; + default = "open-webui"; + }; + + image = mkOption { + type = types.str; + default = "ghcr.io/open-webui/open-webui:ollama"; + }; + + configPath = mkOption { + type = types.str; + default = "/mnt/ssd/nix-app-data/open-webui"; + }; + + puid = mkOption { + type = types.str; + default = "911"; + }; + + pgid = mkOption { + type = types.str; + default = "1000"; + }; + + timeZone = mkOption { + type = types.str; + default = "America/Chicago"; + }; + + }; +} diff --git a/modules/apps/swag/options.nix b/modules/apps/swag/options.nix index 14ad315..c62e93f 100644 --- a/modules/apps/swag/options.nix +++ b/modules/apps/swag/options.nix @@ -65,7 +65,7 @@ with lib; { subdomains = mkOption { type = types.str; - default = "jellyfin,hass,cloud,office,jellyseerr"; + default = "jellyfin,jellyseerr,cloud,office,chat,hass"; }; }; } diff --git a/modules/default.nix b/modules/default.nix index cf89b49..9e1b4c9 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -11,6 +11,8 @@ ./apps/jellyseerr ./apps/mariadb ./apps/nextcloud + ./apps/ollama + ./apps/open-webui ./apps/orca-slicer ./apps/radarr ./apps/sabnzbd