# GLMakie and nixOS

**URL:** <https://discourse.julialang.org/t/glmakie-and-nixos/111897>\
**Category:** General Usage\
**Tags:** makie, glmakie, nixos\
**Created:** [March 20, 2024, 6:01pm UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897 "2024-03-20T18:01:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pablo\_Marchant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablo_marchant/32/32828_2.png) [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Post date:** [March 20, 2024, 6:01pm UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897/1 "2024-03-20T18:01:27Z")

</div>

Just a quick question here, sorry if this is not the right place for it. Has anyone managed to use GLMakie in nixos? Wanted to try out this distro but it seems julia has some issues with it, seems they explicitly say some packages (notably Plots) do not work. In particular with `julia-1.10.2`, trying to set up an empty environment with GLMakie I get a failure at precompilation:

```julia-auto
Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to "/home/pablom/.julia/compiled/v1.10/GLMakie/jl_wXJ2dw".
┌ Warning: GLFW couldn't create an OpenGL window.
│ This likely means, you don't have an OpenGL capable Graphic Card,
│ or you don't have an OpenGL 3.3 capable video driver installed.
│ Have a look at the troubleshooting section in the GLMakie readme:
│ https://github.com/MakieOrg/Makie.jl/tree/master/GLMakie#troubleshooting-opengl.
└ @ GLMakie ~/.julia/packages/GLMakie/QyIWu/src/screen.jl:250
ERROR: LoadError: GLFWError (API_UNAVAILABLE): GLX: No GLXFBConfigs returned
Stacktrace:
  [1] _ErrorCallbackWrapper(code::Int32, description::Cstring)
    @ GLFW ~/.julia/packages/GLFW/BWxfF/src/callback.jl:43
  [2] CreateWindow(width::Int64, height::Int64, title::String, monitor::GLFW.Monitor, share::GLFW.Window)
    @ GLFW ~/.julia/packages/GLFW/BWxfF/src/glfw3.jl:499
  [3] GLFW.Window(; name::String, resolution::Tuple{Int64, Int64}, debugging::Bool, major::Int64, minor::Int64, windowhints::Vector{Tuple{UInt32, Integer}}, contexthints::Vector{Tuple{UInt32, Integer}}, visible::Bool, focus::Bool, fullscreen::Bool, monitor::Nothing, share::GLFW.Window)
    @ GLFW ~/.julia/packages/GLFW/BWxfF/src/glfw3.jl:344
  [4] Window
    @ ~/.julia/packages/GLFW/BWxfF/src/glfw3.jl:302 [inlined]
  [5] empty_screen(debugging::Bool; reuse::Bool)
    @ GLMakie ~/.julia/packages/GLMakie/QyIWu/src/screen.jl:241
  [6] empty_screen
    @ ~/.julia/packages/GLMakie/QyIWu/src/screen.jl:222 [inlined]
  [7] singleton_screen(debugging::Bool)
    @ GLMakie ~/.julia/packages/GLMakie/QyIWu/src/screen.jl:329
  [8] macro expansion
    @ ~/.julia/packages/GLMakie/QyIWu/src/precompiles.jl:21 [inlined]
  [9] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:78 [inlined]
 [10] macro expansion
    @ ~/.julia/packages/GLMakie/QyIWu/src/precompiles.jl:18 [inlined]
 [11] macro expansion
    @ ~/.julia/packages/PrecompileTools/L8A3n/src/workloads.jl:140 [inlined]
 [12] top-level scope
    @ ~/.julia/packages/GLMakie/QyIWu/src/precompiles.jl:16
 [13] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [14] include(x::String)
    @ GLMakie ~/.julia/packages/GLMakie/QyIWu/src/GLMakie.jl:1
 [15] top-level scope
    @ ~/.julia/packages/GLMakie/QyIWu/src/GLMakie.jl:79
 [16] include
    @ ./Base.jl:495 [inlined]
 [17] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2222
 [18] top-level scope
    @ stdin:3
in expression starting at /home/pablom/.julia/packages/GLMakie/QyIWu/src/precompiles.jl:15
in expression starting at /home/pablom/.julia/packages/GLMakie/QyIWu/src/GLMakie.jl:1
in expression starting at stdin:

```

I do have an nvidia card with nvidia drivers setup and openGL enabled

```julia-auto
glxinfo | grep "OpenGL version"
OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.0.2

```

And this works on the same hardware in arch-linux. Is this just a fundamental incompatibility between nixos and GLMakie?

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [March 20, 2024, 6:43pm UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897/2 "2024-03-20T18:43:06Z")

</div>

You just need to tell Julia where to find the opengl driver. One way to do that:

```julia
LD_LIBRARY_PATH=/run/opengl-driver/lib/ julia

```

There is also [GitHub - nix-community/nixGL: A wrapper tool for nix OpenGL application [maintainer=@guibou]](https://github.com/nix-community/nixGL) which I haven’t tried.

---

<div class="post-metadata">

**Author:** ![Pablo\_Marchant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pablo_marchant/32/32828_2.png) [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Post date:** [March 21, 2024, 7:29am UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897/3 "2024-03-21T07:29:54Z")

</div>

thanks, works like a charm 🙂

---

<div class="post-metadata">

**Author:** ![fivegrant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fivegrant/32/47771_2.png) [@fivegrant](https://discourse.julialang.org/u/fivegrant)\
**Post date:** [March 21, 2024, 2:14pm UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897/4 "2024-03-21T14:14:53Z")

</div>

Another option is to install Julia using something like [scientific-fhs](https://github.com/olynch/scientific-fhs). A more sustainable, long-term solution is needed for Julia-Nix integration but scientific-fhs works pretty well for the time being.

---

<div class="post-metadata">

**Author:** ![marteaua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marteaua/32/214927_2.png) [@marteaua](https://discourse.julialang.org/u/marteaua)\
**Post date:** [September 20, 2024, 6:08am UTC](https://discourse.julialang.org/t/glmakie-and-nixos/111897/5 "2024-09-20T06:08:16Z")

</div>

This saved my day, thanks.
