From 4be00f31089e82a50c8ee5fa0a829157dc1b39d5 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Wed, 6 Aug 2025 12:27:15 +0530 Subject: [PATCH] feat: disable smb and enable llama --- flake.lock | 17 +++++++++ flake.nix | 5 +++ home/apps/default.nix | 1 + home/apps/lmstudio.nix | 11 ++++++ nixos/ryu/services/default.nix | 3 +- nixos/ryu/services/llama.nix | 27 ++++++++++++++ nixos/ryu/services/ollama.nix | 12 +++++++ nixos/ryu/services/samba.nix | 66 +++++++++++++++++----------------- overlays.nix | 2 +- 9 files changed, 109 insertions(+), 35 deletions(-) create mode 100644 home/apps/lmstudio.nix create mode 100644 nixos/ryu/services/llama.nix diff --git a/flake.lock b/flake.lock index 32cbbfa7..efe9cd41 100644 --- a/flake.lock +++ b/flake.lock @@ -1698,6 +1698,22 @@ "type": "github" } }, + "ik_llama": { + "flake": false, + "locked": { + "lastModified": 1753582432, + "narHash": "sha256-jEty/2inFD+OgarlWojwJQgP3sn8SkkFW81ZXhJyoBg=", + "owner": "ikawrakow", + "repo": "ik_llama.cpp", + "rev": "ae0ba31fd078282fe6ac675176862ed6955c52dc", + "type": "github" + }, + "original": { + "owner": "ikawrakow", + "repo": "ik_llama.cpp", + "type": "github" + } + }, "ironbar": { "inputs": { "flake-compat": "flake-compat_4", @@ -2602,6 +2618,7 @@ "home-manager-stable": "home-manager-stable", "hyprland": "hyprland", "hyprlock": "hyprlock", + "ik_llama": "ik_llama", "ironbar": "ironbar", "lanzaboote": "lanzaboote", "music-player": "music-player", diff --git a/flake.nix b/flake.nix index b9d5428e..aa2b2b9a 100644 --- a/flake.nix +++ b/flake.nix @@ -187,6 +187,11 @@ # url = "path:/home/servius/Projects/ALVR"; # inputs.nixpkgs.follows = "nixpkgs"; # }; + ik_llama = { + url = "github:ikawrakow/ik_llama.cpp?submodules=1"; + # submodules = true; + flake = false; + }; }; outputs = { diff --git a/home/apps/default.nix b/home/apps/default.nix index f507a9d7..4e8abfcd 100644 --- a/home/apps/default.nix +++ b/home/apps/default.nix @@ -36,5 +36,6 @@ lib.optionalAttrs device.hasGui { ./zathura.nix ./zed.nix ./zen.nix + ./lmstudio.nix ]; } diff --git a/home/apps/lmstudio.nix b/home/apps/lmstudio.nix new file mode 100644 index 00000000..35fce0b0 --- /dev/null +++ b/home/apps/lmstudio.nix @@ -0,0 +1,11 @@ +{ + lib, + device, + pkgs, + ... +}: +lib.optionalAttrs device.hasGui { + home.packages = with pkgs; [ + lmstudio + ]; +} diff --git a/nixos/ryu/services/default.nix b/nixos/ryu/services/default.nix index 8fedf1fc..292beec4 100644 --- a/nixos/ryu/services/default.nix +++ b/nixos/ryu/services/default.nix @@ -4,7 +4,8 @@ # ./sunshine.nix # ./zerotier.nix # ./dnscrypt.nix - ./ollama.nix + # ./ollama.nix + # ./llama.nix ./tailscale.nix ./samba.nix ./mullvad.nix diff --git a/nixos/ryu/services/llama.nix b/nixos/ryu/services/llama.nix new file mode 100644 index 00000000..ea1777aa --- /dev/null +++ b/nixos/ryu/services/llama.nix @@ -0,0 +1,27 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: { + services = { + llama-cpp = { + enable = true; + model = pkgs.fetchurl { + url = "https://huggingface.co/unsloth/gpt-oss-20b-GGUF/resolve/main/gpt-oss-20b-F16.gguf"; + sha256 = "b93a63c42fc2432396b56031bb1a4aa5f598af1de369de397a900888032cad64"; + }; + # package = pkgs.llama-cpp.overrideAttrs (old: { + # src = inputs.ik_llama; + # version = "5995"; + # }); + }; + # caddy = { + # virtualHosts."llama.ryu.darksailor.dev".extraConfig = '' + # import hetzner + # reverse_proxy localhost:${builtins.toString config.services.llama-cpp.port} + # ''; + # }; + }; +} diff --git a/nixos/ryu/services/ollama.nix b/nixos/ryu/services/ollama.nix index b93aa0e6..7efe366a 100644 --- a/nixos/ryu/services/ollama.nix +++ b/nixos/ryu/services/ollama.nix @@ -17,6 +17,18 @@ LD_LIBRARY_PATH = "run/opengl-driver/lib"; HTTP_PROXY = "https://ollama.ryu.darksailor.dev"; }; + package = pkgs.ollama.overrideAttrs { + version = "0.11.0"; + src = pkgs.fetchFromGitHub { + owner = "ollama"; + repo = "ollama"; + tag = "v0.11.0"; + hash = "sha256-po7BxJAj9eOpOaXsLDmw6/1RyjXPtXza0YUv0pVojZ0="; + fetchSubmodules = true; + }; + doCheck = false; + vendorHash = "sha256-SlaDsu001TUW+t9WRp7LqxUSQSGDF1Lqu9M1bgILoX4="; + }; }; # open-webui = { # enable = false; diff --git a/nixos/ryu/services/samba.nix b/nixos/ryu/services/samba.nix index cd1fce81..7f88d994 100644 --- a/nixos/ryu/services/samba.nix +++ b/nixos/ryu/services/samba.nix @@ -1,36 +1,36 @@ {...}: { - services = { - samba = { - enable = true; - openFirewall = true; - settings = { - global = { - "workgroup" = "WORKGROUP"; - "server string" = "smbnix"; - "netbios name" = "smbnix"; - "security" = "user"; - "hosts allow" = "192.168.11. 127.0.0.1 localhost"; - "hosts deny" = "0.0.0.0/0"; - "guest account" = "nobody"; - "map to guest" = "bad user"; - }; - - public = { - "path" = "/media"; - "browseable" = "yes"; - "read only" = "no"; - "guest ok" = "yes"; - "create mask" = "0644"; - "directory mask" = "0755"; - # "force user" = "username"; - # "force group" = "groupname"; - }; - }; - }; - samba-wsdd = { - enable = true; - openFirewall = true; - }; - }; + # services = { + # samba = { + # enable = false; + # openFirewall = true; + # settings = { + # global = { + # "workgroup" = "WORKGROUP"; + # "server string" = "smbnix"; + # "netbios name" = "smbnix"; + # "security" = "user"; + # "hosts allow" = "192.168.11. 127.0.0.1 localhost"; + # "hosts deny" = "0.0.0.0/0"; + # "guest account" = "nobody"; + # "map to guest" = "bad user"; + # }; + # + # public = { + # "path" = "/media"; + # "browseable" = "yes"; + # "read only" = "no"; + # "guest ok" = "yes"; + # "create mask" = "0644"; + # "directory mask" = "0755"; + # # "force user" = "username"; + # # "force group" = "groupname"; + # }; + # }; + # }; + # samba-wsdd = { + # enable = true; + # openFirewall = true; + # }; + # }; networking.firewall.allowPing = true; } diff --git a/overlays.nix b/overlays.nix index 7c00238b..49c26c9c 100644 --- a/overlays.nix +++ b/overlays.nix @@ -70,7 +70,7 @@ pkgs.openssl ]; PKG_CONFIG_PATH = with final; pkgs.lib.makeSearchPath "lib/pkgconfig" [pkgs.openssl.dev]; - nativeBuildINputs = with final; [pkgs.pkg-config]; + nativeBuildInputs = with final; [pkgs.pkg-config]; }; picat = let picat-src = final.pkgs.fetchFromGitHub {