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";
|
description = "Server for local large language models";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
environment = cfg.environmentVariables // {
|
environment =
|
||||||
HOME = cfg.home;
|
cfg.environmentVariables
|
||||||
OLLAMA_MODELS = cfg.models;
|
// {
|
||||||
OLLAMA_HOST = "${cfg.host}:${toString cfg.port}";
|
HOME = cfg.home;
|
||||||
HSA_OVERRIDE_GFX_VERSION = lib.mkIf (cfg.rocmOverrideGfx != null) cfg.rocmOverrideGfx;
|
OLLAMA_MODELS = cfg.models;
|
||||||
};
|
OLLAMA_HOST = "${cfg.host}:${toString cfg.port}";
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (cfg.rocmOverrideGfx != null) {
|
||||||
|
HSA_OVERRIDE_GFX_VERSION = cfg.rocmOverrideGfx;
|
||||||
|
};
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
lib.optionalAttrs staticUser {
|
lib.optionalAttrs staticUser {
|
||||||
User = cfg.user;
|
User = cfg.user;
|
||||||
|
|
Loading…
Reference in a new issue