Skip to content

Instantly share code, notes, and snippets.

@cireu
Last active July 26, 2025 13:50
Show Gist options
  • Save cireu/141db8a88c3e120740c429a69a8f5d4e to your computer and use it in GitHub Desktop.
Save cireu/141db8a88c3e120740c429a69a8f5d4e to your computer and use it in GitHub Desktop.
Use nix-ld in Guix
  1. First create a symbolic link to the linker provided by nix-ld at /lib64/ld-linux-x86-64.so.2 (assuming you're using x86_64)

I've done some works in https://gitlab.com/citreu/cireguix/-/blob/master/ciregnu/services/nix-ld.scm?ref_type=heads, it's far from perfect so I haven't upstream it.

  1. Create a profile contains commonly used libraries

Here's an example (the libraries are shamelessly copied from AppImage project)

(concatenate-manifests
 (list
  (specifications->manifest
   '("glibc"
     ;; "gcc:lib"
     "mesa"
     "libxcb"
     "libx11"
     "libxcomposite"
     "libxrandr"
     "libxrender"
     "libxext"
     "libxfixes"
     "libxinerama"
     "libxdamage"
     "libxcursor"
     "libxscrnsaver"
     "libxtst"
     "libxi"
     "libsm"
     "libice"

     "dbus"
     ;; "glib"
     ;; "gtk+@2"
     "gtk+@3"
     "libdbusmenu"
     ;; "at-spi2-core"
     "gdk-pixbuf"
     "webp-pixbuf-loader"
     ;; "cairo" propagated by gtk+
     ;; "cairo"
     ;; "pango"

     "alsa-lib"
     "fontconfig"
     "libthai"
     "freetype"
     ;; "harfbuzz"
     "fribidi"
     "expat"
     "util-linux:lib"                   ;libuuid
     "zlib"
     "libgcrypt"

     "nss"
     ;; "nspr" ;propagated from nss
     "openssl"
     "cups"

     "pulseaudio"
     ))
  (packages->manifest
   `((,(@ (gnu packages gcc) gcc) "lib")))))
  1. Setup environment variables.

I've done it in Guix Home, but you can do it in the way you like

export NIX_LD=<path-to-glibc-dynamic-linker>
# NSS library in Guix are under different directory
export NIX_LD_LIBRARY_PATH=/<path-to-libraries-profile-prefix>/lib:<path-to-libraries-profile-prefix>/lib/nss

That's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment