mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
nixos/ollama: make rocmOverrideGfx
backward compatible
The initial version of `rocmOverrideGfx` incorrectly used `lib.mkIf` in an attempt to prevent interference with previous uses of `environmentVariables.HSA_OVERRIDE_GFX_VERSION`. However, the effect was actually to simply erase existing definitions of `HSA_OVERRIDE_GFX_VERSION` until `rocmOverrideGfx` was set, which was the situation I was trying to avoid in the first place. This fixes the bug by switching from `lib.mkIf` to `lib.optionalAttrs`.
This commit is contained in:
parent
339d0cd68c
commit
084f6a3e26
|
@ -184,12 +184,16 @@ in
|
|||
description = "Server for local large language models";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
environment = cfg.environmentVariables // {
|
||||
HOME = cfg.home;
|
||||
OLLAMA_MODELS = cfg.models;
|
||||
OLLAMA_HOST = "${cfg.host}:${toString cfg.port}";
|
||||
HSA_OVERRIDE_GFX_VERSION = lib.mkIf (cfg.rocmOverrideGfx != null) cfg.rocmOverrideGfx;
|
||||
};
|
||||
environment =
|
||||
cfg.environmentVariables
|
||||
// {
|
||||
HOME = cfg.home;
|
||||
OLLAMA_MODELS = cfg.models;
|
||||
OLLAMA_HOST = "${cfg.host}:${toString cfg.port}";
|
||||
}
|
||||
// lib.optionalAttrs (cfg.rocmOverrideGfx != null) {
|
||||
HSA_OVERRIDE_GFX_VERSION = cfg.rocmOverrideGfx;
|
||||
};
|
||||
serviceConfig =
|
||||
lib.optionalAttrs staticUser {
|
||||
User = cfg.user;
|
||||
|
|
Loading…
Reference in a new issue