feat(nvim): add gen.nvim and ollama service
parent
ddc2989620
commit
82ffbcbde4
17
flake.lock
17
flake.lock
|
@ -315,6 +315,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gen-nvim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1702112421,
|
||||
"narHash": "sha256-oF6LT8Q6Dp4mKDNTcm/hx0F8a6iN/HvpZKgGRkctrI4=",
|
||||
"owner": "David-Kunz",
|
||||
"repo": "gen.nvim",
|
||||
"rev": "1319b03357fd7017bbaf1d45cd6b72bd9e106226",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "David-Kunz",
|
||||
"repo": "gen.nvim",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -1043,6 +1059,7 @@
|
|||
"disko": "disko",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils",
|
||||
"gen-nvim": "gen-nvim",
|
||||
"hmts-nvim": "hmts-nvim",
|
||||
"home-manager": "home-manager_2",
|
||||
"hypr-contrib": "hypr-contrib",
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
neotest-python.url = "github:MoritzBoehme/neotest-python/fix-runtimepath-search";
|
||||
statuscol-nvim.flake = false;
|
||||
statuscol-nvim.url = "github:luukvbaal/statuscol.nvim/0.10"; # HACK: fix for neovim-nightly
|
||||
gen-nvim.flake = false;
|
||||
gen-nvim.url = "github:David-Kunz/gen.nvim";
|
||||
|
||||
# Hyprland
|
||||
hypr-contrib.url = "github:hyprwm/contrib";
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
keyboardLayouts = [ "us" "de" ];
|
||||
};
|
||||
services.wallpaper.enable = true;
|
||||
services.ollama.enable = true;
|
||||
programs.ledger.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
with builtins;
|
||||
{
|
||||
|
@ -332,5 +332,25 @@ with builtins;
|
|||
};
|
||||
cmd = [ "Neogen" ];
|
||||
}
|
||||
{
|
||||
plugin = gen-nvim;
|
||||
init = /* lua */ ''
|
||||
require("gen").setup({
|
||||
model = "zephyr:7b-beta", -- The default model to use.
|
||||
display_mode = "float", -- The display mode. Can be "float" or "split".
|
||||
show_prompt = false, -- Shows the Prompt submitted to Ollama.
|
||||
show_model = false, -- Displays which model you are using at the beginning of your chat session.
|
||||
no_auto_close = false, -- Never closes the window automatically.
|
||||
init = function(options) end,
|
||||
-- Function to initialize Ollama
|
||||
command = "${lib.getExe pkgs.curl} --silent --no-buffer -X POST http://localhost:11434/api/generate -d $body",
|
||||
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
|
||||
-- This can also be a lua function returning a command string, with options as the input parameter.
|
||||
-- The executed command must return a JSON object with { response, context }
|
||||
-- (context property is optional).
|
||||
debug = false -- Prints errors and the command which is run.
|
||||
})
|
||||
'';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.services.ollama;
|
||||
in
|
||||
{
|
||||
options.my.services.ollama = {
|
||||
enable = mkEnableOption "ollama";
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.ollama;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.user.services.ollama = {
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "1s";
|
||||
ExecStart = "${getExe cfg.package} serve";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -61,5 +61,11 @@ with lib.my;
|
|||
version = mkVersionInput inputs.neotest-python;
|
||||
src = inputs.neotest-python;
|
||||
});
|
||||
|
||||
gen-nvim = prev.vimUtils.buildVimPlugin {
|
||||
pname = "gen-nvim";
|
||||
version = mkVersionInput inputs.gen-nvim;
|
||||
src = inputs.gen-nvim;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue