fix(neovim): make ollama optional

This commit is contained in:
Alexandre Cavalheiro 2025-01-16 21:03:29 -03:00
parent 925551ec26
commit 0ad475e6bf
Signed by: wizardlink
GPG key ID: A5767B54367CFBDF
2 changed files with 26 additions and 12 deletions

View file

@ -25,7 +25,11 @@
};
outputs =
{ home-manager, nixpkgs, ... }@inputs:
{
home-manager,
nixpkgs,
...
}@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};

View file

@ -6,14 +6,21 @@
}:
let
inherit (lib) types mkOption;
ollamaPackage =
inherit (lib)
types
mkOption
mkIf
mkEnableOption
;
ollamaPackage = mkIf config.programs.neovim.ollama.enable (
if config.programs.neovim.ollama.type == "amd" then
pkgs.ollama-rocm
else if config.programs.neovim.ollama.type == "nvidia" then
pkgs.ollama-cuda
else
pkgs.ollama;
pkgs.ollama
);
in
{
options.programs.neovim = {
@ -33,7 +40,9 @@ in
};
};
ollama.type = mkOption {
ollama = {
enable = mkEnableOption "enable";
type = mkOption {
default = "amd";
description = "The type of ollama package to install, AMD GPU accelerated or NVIDIA GPU accelerated.";
example = "amd";
@ -43,6 +52,7 @@ in
];
};
};
};
config = {
programs.neovim = {