Add a nix-ld aspect for foreign binaries and AppImages
Move programs.nix-ld out of the core aspect into modules/dev/nix-ld.nix and extend the library set (on top of the module defaults) with the runtime libraries that prebuilt binaries commonly link or dlopen: C++ runtime, compression and crypto, GL/Vulkan/Wayland, audio, fonts, GTK and Electron-style helpers, and the X11 client libraries. Enable programs.appimage with binfmt so .AppImage files run directly through appimage-run. Import the aspect from the desktop host and document it in the README. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
This commit is contained in:
4 files changed
+134
-6
No files matched your search
@@ -21,7 +21,8 @@ is a secondary remote.
|
||||
- **Full AMD**: AMD CPU, Radeon GPU (Mesa, LACT, optional ROCm).
|
||||
- **Network**: proxy-suite (zapret, Telegram WebSocket proxy), AmneziaVPN,
|
||||
NetworkManager with the OpenVPN plugin.
|
||||
- **Dev**: Docker (rootless and rootful), a Gitea Actions runner, and **Claude
|
||||
- **Dev**: Docker (rootless and rootful), a Gitea Actions runner, **nix-ld**
|
||||
and AppImage support for binaries built for other distros, and **Claude
|
||||
Code** with codebase-memory-mcp, Serena, REA and caveman.
|
||||
- **Disks via disko, btrfs, no encryption**:
|
||||
- NVMe: ESP (`/boot`, 2G) + btrfs `nixos` with `@root @home @nix @log @swap`
|
||||
@@ -49,7 +50,7 @@ modules/ every .nix file below is a flake-parts module (import-tree)
|
||||
hardware/ amd (CPU, GPU, LACT), rocm (optional, not imported by desktop)
|
||||
security/ secrets (agenix), ssh (server and client)
|
||||
network/ vpn (AmneziaVPN), proxy-suite (zapret, Telegram proxy)
|
||||
dev/ docker, gitea-runner
|
||||
dev/ docker, gitea-runner, nix-ld (foreign binaries, AppImage)
|
||||
desktop/ hyprland (+ its Lua files), noctalia, audio, fonts, wezterm, xdg, apps
|
||||
theme/ stylix: scheme, fonts, cursor, icons, target list
|
||||
cli/ shell, git, neovim
|
||||
@@ -463,7 +464,7 @@ What is not hermetic or worth knowing:
|
||||
|
||||
- **REA runs from npm**: the first start downloads the pinned version and its
|
||||
dependencies into `~/.npm` (needs network; the dependency tree is not pinned).
|
||||
Its prebuilt native binaries rely on `programs.nix-ld` (enabled). REA's skill
|
||||
Its prebuilt native binaries rely on the `nix-ld` aspect. REA's skill
|
||||
and caveman are fetched with fixed hashes.
|
||||
- **Serena writes `.serena/` into every project it activates** (it is in this
|
||||
repository's `.gitignore`). It is built locally from its lock file, not
|
||||
@@ -516,6 +517,16 @@ then add `Projects = { };` to `homeFolders` in `modules/hosts/desktop/disks.nix`
|
||||
**Change a secret**: `cd secrets && agenix -e faumaray-password.age -i ~/.ssh/id_ed25519`
|
||||
(or run `set-password` / `secret-from-file` again with `--force`), `git add`, switch.
|
||||
|
||||
### Foreign binaries (nix-ld, AppImage)
|
||||
|
||||
The `nix-ld` aspect (`modules/dev/nix-ld.nix`) runs programs built for other
|
||||
Linux distributions. nix-ld gives plain ELF binaries a dynamic linker and a broad
|
||||
library set (`NIX_LD`, `NIX_LD_LIBRARY_PATH`); `.AppImage` files run directly
|
||||
through `appimage-run` (binfmt). When a binary stops with `error while loading
|
||||
shared libraries: libfoo.so.N`, add the package that ships it to
|
||||
`programs.nix-ld.libraries` in that file and switch. AppImages do not use
|
||||
nix-ld: give them extra libraries through `programs.appimage.package`.
|
||||
|
||||
### Verify in a fresh session
|
||||
|
||||
From the repository root of a fresh clone or shell (new files must be
|
||||
|
||||
@@ -46,9 +46,6 @@ in
|
||||
enable = true;
|
||||
flake = "/home/${owner.name}/nixos-config";
|
||||
};
|
||||
|
||||
# Lets prebuilt binaries (editors' language servers, game launchers) run.
|
||||
nix-ld.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
# Foreign binaries: programs built for ordinary Linux distributions (prebuilt
|
||||
# tools, language servers, npm/pip native modules, game launchers, AppImages)
|
||||
# expect /lib64/ld-linux-x86-64.so.2 and libraries in /usr/lib, neither of
|
||||
# which exists on NixOS. Two mechanisms cover that:
|
||||
#
|
||||
# - nix-ld puts a stub dynamic linker at the standard path. The stub reads
|
||||
# NIX_LD (the real linker) and NIX_LD_LIBRARY_PATH (the library directory
|
||||
# built from `programs.nix-ld.libraries`), both exported to every session,
|
||||
# and starts the program with them. A plain ELF binary then just runs. If it
|
||||
# stops with "error while loading shared libraries: libfoo.so.N", find the
|
||||
# nixpkgs package that ships that library (search.nixos.org), add it to the
|
||||
# list below and switch.
|
||||
# - AppImages bundle most of their libraries and want FUSE. appimage-run runs
|
||||
# them in an FHS environment of its own, and the binfmt registration makes
|
||||
# `./Some.AppImage` work directly. nix-ld is not involved there; to give
|
||||
# every AppImage an extra library set
|
||||
# `programs.appimage.package = pkgs.appimage-run.override { extraPkgs = pkgs: [ ... ]; };`.
|
||||
#
|
||||
# The module's own defaults (zlib, zstd, stdenv.cc.cc, curl, openssl, attr,
|
||||
# libssh, bzip2, libxml2, acl, libsodium, util-linux, xz, systemd) stay; the
|
||||
# list is merged with them. The ones repeated below are the base every
|
||||
# foreign binary needs, kept explicit so they survive a change of the defaults.
|
||||
# No whole desktop stacks (Qt, Electron) here: an app that needs one ships it
|
||||
# or gets a package of its own.
|
||||
{
|
||||
flake.modules.nixos.nix-ld =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
# C/C++ runtime (libstdc++, libgcc_s), compression, crypto, text.
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
zstd
|
||||
bzip2
|
||||
xz
|
||||
openssl
|
||||
curl
|
||||
expat
|
||||
icu
|
||||
libxml2
|
||||
libxslt
|
||||
sqlite
|
||||
libffi
|
||||
ncurses
|
||||
libxcrypt-legacy # libcrypt.so.1, which older binaries still link
|
||||
libunwind
|
||||
libsecret
|
||||
libusb1
|
||||
util-linux # libuuid, libmount, libblkid
|
||||
systemd # libudev, libsystemd
|
||||
|
||||
# Graphics: OpenGL, EGL, Vulkan, hardware video, Wayland.
|
||||
libGL
|
||||
libGLU
|
||||
mesa
|
||||
libgbm
|
||||
libdrm
|
||||
vulkan-loader
|
||||
libva
|
||||
libvdpau
|
||||
wayland
|
||||
libxkbcommon
|
||||
|
||||
# Audio.
|
||||
alsa-lib
|
||||
libpulseaudio
|
||||
pipewire
|
||||
SDL2
|
||||
|
||||
# Fonts and images.
|
||||
fontconfig
|
||||
freetype
|
||||
harfbuzz
|
||||
libpng
|
||||
libjpeg
|
||||
|
||||
# GTK and the pieces Electron/Chromium-style apps dlopen.
|
||||
glib
|
||||
gtk3
|
||||
gdk-pixbuf
|
||||
pango
|
||||
cairo
|
||||
at-spi2-core # also ships libatk and libatk-bridge
|
||||
cups
|
||||
dbus
|
||||
nspr
|
||||
nss
|
||||
libnotify
|
||||
libappindicator
|
||||
libayatana-appindicator
|
||||
|
||||
# X11 client libraries (XWayland keeps X11-only binaries working).
|
||||
libx11
|
||||
libxcomposite
|
||||
libxcursor
|
||||
libxdamage
|
||||
libxext
|
||||
libxfixes
|
||||
libxi
|
||||
libxrandr
|
||||
libxrender
|
||||
libxscrnsaver
|
||||
libxtst
|
||||
libxcb
|
||||
libxxf86vm
|
||||
libxshmfence
|
||||
];
|
||||
};
|
||||
|
||||
# `appimage-run` plus the binfmt hooks for AppImage type 1 and 2; the
|
||||
# module also enables FUSE.
|
||||
programs.appimage = {
|
||||
enable = true;
|
||||
binfmt = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -28,6 +28,7 @@ in
|
||||
proxy-suite
|
||||
docker
|
||||
gitea-runner
|
||||
nix-ld
|
||||
];
|
||||
|
||||
# The owner's own programs (home-manager only). A dynamic attribute such
|
||||
|
||||
Reference in new issue
Block a user