Begin add AI module
This commit is contained in:
parent
a4eeb89eb6
commit
53583fc4c7
2 changed files with 28 additions and 2 deletions
26
modules/ai.nix
Normal file
26
modules/ai.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.customModules.AI = {
|
||||
enable = mkEnableOption ''
|
||||
Enable AI
|
||||
'';
|
||||
};
|
||||
config =
|
||||
let
|
||||
cfg = config.customModules.AI;
|
||||
nvidiaEnabled = config.hardware.nvidia.modesetting.enable;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
|
||||
acceleration =
|
||||
if nvidiaEnabled then
|
||||
"cuda"
|
||||
else
|
||||
null;
|
||||
};
|
||||
}
|
||||
// mkIf nvidiaEnabled { environment.systemPackages = with pkgs; [cudatoolkit]; };
|
||||
}
|
|
@ -18,8 +18,8 @@ with lib;
|
|||
|
||||
hooks.qemu = {
|
||||
is_working = "${pkgs.writeShellScript "testHook.sh" ''
|
||||
+ touch /tmp/qemu_hook_is_working
|
||||
+ ''}";
|
||||
touch /tmp/qemu_hook_is_working
|
||||
''}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue