From 41b97ef1d1bcd2016433d171da168bddcb101008 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 18 Dec 2024 10:38:50 -0600 Subject: [PATCH] adding a true ollama config and updating to latest nixpkgs --- flake.lock | 16 +++---- flake.nix | 11 +++-- modules/ollama.nix | 16 +++++-- system/shen/configuration.nix | 81 +++++++++++++++++------------------ 4 files changed, 68 insertions(+), 56 deletions(-) diff --git a/flake.lock b/flake.lock index 05867cc..abdccee 100644 --- a/flake.lock +++ b/flake.lock @@ -50,16 +50,16 @@ ] }, "locked": { - "lastModified": 1720042825, - "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "lastModified": 1734366194, + "narHash": "sha256-vykpJ1xsdkv0j8WOVXrRFHUAdp9NXHpxdnn1F4pYgSw=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "rev": "80b0fdf483c5d1cb75aaad909bd390d48673857f", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-24.05", + "ref": "release-24.11", "repo": "home-manager", "type": "github" } @@ -136,16 +136,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1732749044, - "narHash": "sha256-T38FQOg0BV5M8FN1712fovzNakSOENEYs+CSkg31C9Y=", + "lastModified": 1734323986, + "narHash": "sha256-m/lh6hYMIWDYHCAsn81CDAiXoT3gmxXI9J987W5tZrE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0c5b4ecbed5b155b705336aa96d878e55acd8685", + "rev": "394571358ce82dff7411395829aa6a3aad45b907", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-24.05", + "ref": "nixos-24.11", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 8a47ed6..2bf410d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,9 +3,9 @@ inputs = { nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; home-manager = { - url = "github:nix-community/home-manager/release-24.05"; + url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; }; nix-bitcoin = { @@ -23,13 +23,17 @@ }; lib = nixpkgs.lib; - unstable = nixpkgs; + unstable = import nixpkgs-unstable { + inherit system; + config = { allowUnfree = true; }; + }; in { nixosConfigurations = { shen = lib.nixosSystem { inherit system; pkgs = pkgsForSystem; + specialArgs = { inherit unstable; }; modules = [ ./system/shen/configuration.nix home-manager.nixosModules.home-manager @@ -43,6 +47,7 @@ hoid = lib.nixosSystem { inherit system; pkgs = pkgsForSystem; + specialArgs = { inherit unstable; }; modules = [ ./system/hoid/configuration.nix home-manager.nixosModules.home-manager diff --git a/modules/ollama.nix b/modules/ollama.nix index 99f9e5e..3cf85ba 100644 --- a/modules/ollama.nix +++ b/modules/ollama.nix @@ -1,8 +1,18 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, unstable, ... }: with lib; { - services.ollama = { - enable = true; + services = { + ollama = { + enable = true; + package = unstable.ollama; + # port = 11434; + acceleration = "cuda"; + }; + open-webui = { + enable = true; + port = 3082; + package = unstable.open-webui; + }; }; } diff --git a/system/shen/configuration.nix b/system/shen/configuration.nix index e141355..96451a5 100644 --- a/system/shen/configuration.nix +++ b/system/shen/configuration.nix @@ -12,6 +12,7 @@ ../../modules/base.nix ../../modules/localai.nix ../../modules/forgejo.nix + ../../modules/ollama.nix # ../../pkgs/server.nix # ../../pkgs/ai.nix ]; @@ -44,7 +45,6 @@ # rocm-opencl-runtime # amdvlk ]; - driSupport = lib.mkDefault true; driSupport32Bit = lib.mkDefault true; #extraPackages32 = with pkgs; [ # driversi686linux.amdvlk @@ -52,7 +52,8 @@ }; nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.stable; + open = false; + # package = config.boot.kernelPackages.nvidiaPackages.stable; modesetting.enable = true; }; }; @@ -64,41 +65,41 @@ virtualisation.docker.enableNvidia = true; - services.samba = { - enable = true; - extraConfig = '' - # security = share - # passdb backend = tdbsam - workgroup = WORKGROUP - server string = smbnix - netbios name = smbnix - security = user - #use sendfile = yes - #max protocol = smb2 - # note: localhost is the ipv6 localhost ::1 - hosts allow = 172.16.1. 127.0.0.1 localhost - hosts deny = 0.0.0.0/0 - guest account = chris - map to guest = bad user - ''; - shares = { - public = { - path = "/storage/share"; - # "valid users" = "tfc"; - public = "yes"; - writeable = "yes"; - browsable = "yes"; - "read only" = "no"; - "create mask" = "0644"; - "directory mask" = "0755"; - "guest ok" = "yes"; - "force user" = "chris"; - "fruit:aapl" = "yes"; - "fruit:time machine" = "yes"; - "vfs objects" = "catia fruit streams_xattr"; - }; - }; - }; + # services.samba = { + # enable = true; + # extraConfig = '' + # # security = share + # # passdb backend = tdbsam + # workgroup = WORKGROUP + # server string = smbnix + # netbios name = smbnix + # security = user + # #use sendfile = yes + # #max protocol = smb2 + # # note: localhost is the ipv6 localhost ::1 + # hosts allow = 172.16.1. 127.0.0.1 localhost + # hosts deny = 0.0.0.0/0 + # guest account = chris + # map to guest = bad user + # ''; + # shares = { + # public = { + # path = "/storage/share"; + # # "valid users" = "tfc"; + # public = "yes"; + # writeable = "yes"; + # browsable = "yes"; + # "read only" = "no"; + # "create mask" = "0644"; + # "directory mask" = "0755"; + # "guest ok" = "yes"; + # "force user" = "chris"; + # "fruit:aapl" = "yes"; + # "fruit:time machine" = "yes"; + # "vfs objects" = "catia fruit streams_xattr"; + # }; + # }; + # }; # CADDY services.caddy = { @@ -258,11 +259,7 @@ virtualHosts = { "tfcconnection.org".extraConfig = '' encode gzip - handle_path /api* { - reverse_proxy * 127.0.0.1:4242 - } - root * /srv/tfcconnection - file_server + reverse_proxy localhost:4242 header { Access-Control-Allow-Origin * Access-Control-Allow-Origin https://api.tfcconnection.org