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