Ollama: Use pkgsUnstable.
This commit is contained in:
parent
d056351de9
commit
93c1ae56d8
17
flake.lock
17
flake.lock
|
@ -363,6 +363,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgsUnstable": {
|
||||
"locked": {
|
||||
"lastModified": 1729413321,
|
||||
"narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1717298511,
|
||||
|
@ -752,6 +768,7 @@
|
|||
"nixpkgsJobber": "nixpkgsJobber",
|
||||
"nixpkgsMaster": "nixpkgsMaster",
|
||||
"nixpkgsStable": "nixpkgsStable",
|
||||
"nixpkgsUnstable": "nixpkgsUnstable",
|
||||
"nvimAlign": "nvimAlign",
|
||||
"nvimAutoclose": "nvimAutoclose",
|
||||
"nvimBufferline": "nvimBufferline",
|
||||
|
|
10
flake.nix
10
flake.nix
|
@ -8,6 +8,7 @@
|
|||
# Manual: https://nixos.org/manual/nixos/stable
|
||||
# Search: https://search.nixos.org/packages and https://search.nixos.org/options
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgsUnstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgsStable.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||
nixpkgsMaster.url = "github:nixos/nixpkgs/master";
|
||||
|
||||
|
@ -120,6 +121,7 @@
|
|||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgsUnstable,
|
||||
nixpkgsStable,
|
||||
nixpkgsMaster,
|
||||
nix-on-droid,
|
||||
|
@ -221,6 +223,7 @@
|
|||
|
||||
pkgsJobber = nixpkgsJobber.legacyPackages.${system}.pkgs;
|
||||
pkgsStable = nixpkgsStable.legacyPackages.${system}.pkgs;
|
||||
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
|
||||
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
||||
|
||||
secret = import ./secret { }; # Secrets (public keys).
|
||||
|
@ -265,6 +268,7 @@
|
|||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgsStable = nixpkgsStable.legacyPackages.${system};
|
||||
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system};
|
||||
pkgsMaster = nixpkgsMaster.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
|
@ -327,9 +331,13 @@
|
|||
# Android.
|
||||
nixOnDroidConfigurations.default =
|
||||
let
|
||||
system = "aarch64-linux";
|
||||
config = self.nixOnDroidConfigurations.default.config;
|
||||
lib = nixpkgs.lib;
|
||||
pkgs = nixpkgs.legacyPackages."aarch64-linux".pkgs;
|
||||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||
pkgsStable = nixpkgsStable.legacyPackages.${system}.pkgs;
|
||||
pkgsUnstable = nixpkgsUnstable.legacyPackages.${system}.pkgs;
|
||||
pkgsMaster = nixpkgsMaster.legacyPackages.${system}.pkgs;
|
||||
in
|
||||
nix-on-droid.lib.nixOnDroidConfiguration {
|
||||
modules = [
|
||||
|
|
|
@ -1,31 +1,29 @@
|
|||
# SRC: https://github.com/ollama/ollama
|
||||
{
|
||||
pkgsStable,
|
||||
pkgsUnstable,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
pkgs = pkgsStable;
|
||||
cfg = config.module.ollama;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
module.ollama = {
|
||||
enable = mkEnableOption "Local LLM server";
|
||||
primaryModel = mkOption {
|
||||
enable = lib.mkEnableOption "Local LLM server";
|
||||
primaryModel = lib.mkOption {
|
||||
default = "llama3.2";
|
||||
type = types.str;
|
||||
type = lib.types.str;
|
||||
};
|
||||
models = mkOption {
|
||||
models = lib.mkOption {
|
||||
default = [ cfg.primaryModel ];
|
||||
type = types.listOf types.str;
|
||||
type = with lib.types; listOf str;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment = {
|
||||
# Specify default model.
|
||||
variables.OLLAMA_MODEL = cfg.primaryModel;
|
||||
|
@ -38,7 +36,7 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "simple";
|
||||
script = ''
|
||||
HOME=/root ${getExe pkgs.ollama} serve
|
||||
HOME=/root ${lib.getExe pkgsUnstable.ollama} serve
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -57,7 +55,7 @@ in
|
|||
serviceConfig.Type = "simple";
|
||||
script = ''
|
||||
sleep 5
|
||||
${getExe pkgs.ollama} pull ${concatStringsSep " " cfg.models}
|
||||
${lib.getExe pkgsUnstable.ollama} pull ${lib.concatStringsSep " " cfg.models}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue