Begin add AI module

This commit is contained in:
Florian RICHER 2024-05-24 14:04:57 +02:00
parent a4eeb89eb6
commit 53583fc4c7
2 changed files with 28 additions and 2 deletions

26
modules/ai.nix Normal file
View 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]; };
}

View file

@ -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
''}";
};
};
};