# Ollama: OLLAMA\_HOST environment variable does not work

**URL:** https://discourse.nixos.org/t/ollama-ollama-host-environment-variable-does-not-work/54542
**Category:** Help
**Created:** [October 18, 2024, 4:34pm UTC](https://discourse.nixos.org/t/ollama-ollama-host-environment-variable-does-not-work/54542 "2024-10-18T16:34:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dfense](https://discourse.nixos.org/user_avatar/discourse.nixos.org/dfense/32/28855_2.png) [@dfense](https://discourse.nixos.org/u/dfense)
#### Post date: [October 18, 2024, 4:34pm UTC](https://discourse.nixos.org/t/ollama-ollama-host-environment-variable-does-not-work/54542/1 "2024-10-18T16:34:55Z")

</div>

I would like to have my ollama service accessible by another host and therefore need the environment variable OLLAMA\_HOST set to 0.0.0.0:11434.  
I tried to configure it per the manual:

```auto
services.ollama = {
     enable = true;
     acceleration = "rocm";
     environmentVariables = {
       ROC_ENABLE_PRE_VEGA = "1";
       HSA_OVERRIDE_GFX_VERSION = "11.0.0";
       OLLAMA_HOST = "0.0.0.0:11434";
     };
   };

```

This does not work, the service is not accessible and ss -tuln also shows  
`127.0.0.1:11434`  
Also, in /etc/systemd/system/ollama.service the entry is

```auto
Environment="OLLAMA_HOST=127.0.0.1:11434"

```

I searched the internet up and down, but I am stuck…  
Thanks for any help or debugging pointers.

---

<div class="post-metadata">

### Author: ![tmarkov](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/t/df705f/32.png) [@tmarkov](https://discourse.nixos.org/u/tmarkov)
#### Post date: [October 18, 2024, 4:38pm UTC](https://discourse.nixos.org/t/ollama-ollama-host-environment-variable-does-not-work/54542/2 "2024-10-18T16:38:32Z")

</div>

Why aren’t you using `services.ollama.host`?

---

<div class="post-metadata">

### Author: ![dfense](https://discourse.nixos.org/user_avatar/discourse.nixos.org/dfense/32/28855_2.png) [@dfense](https://discourse.nixos.org/u/dfense)
#### Post date: [October 18, 2024, 6:47pm UTC](https://discourse.nixos.org/t/ollama-ollama-host-environment-variable-does-not-work/54542/3 "2024-10-18T18:47:28Z")

</div>

Feel stupid…  
I never saw/realized that this was a direct option. Worked and thanks a lot!
