This commit is contained in:
parent
e493646556
commit
4e8b840830
4 changed files with 88 additions and 55 deletions
34
tips/how_to_test_pr.md
Normal file
34
tips/how_to_test_pr.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Example for ollama
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.system.server.ollama;
|
||||
nvidiaEnabled = config.modules.system.hardware.nvidia.enable;
|
||||
nixpkgsPr = builtins.fetchTarball {
|
||||
url = "https://github.com/abysssol/nixpkgs/archive/ollama-driver-runpath.tar.gz";
|
||||
sha256 = "1ixfvdpi2v4r9yrkvqnfk9whs8lyjhrkdph47bcznh8ak9aipr8p";
|
||||
};
|
||||
in
|
||||
{
|
||||
disabledModules = [ "services/misc/ollama.nix" ];
|
||||
imports = [
|
||||
(import "${nixpkgsPr}/nixos/modules/services/misc/ollama.nix")
|
||||
];
|
||||
|
||||
options.modules.system.server.ollama = {
|
||||
enable = mkEnableOption ''
|
||||
Enable ollama with my custom configurations
|
||||
'';
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
|
||||
package = (import nixpkgsPr { inherit (pkgs) system; config.allowUnfree = true; }).ollama;
|
||||
|
||||
acceleration = if nvidiaEnabled then "cuda" else null;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue