Add compile-time flags for mise python-build on NixOS

python-build compiles from source and needs headers/library paths.
nix-ld only handles runtime linking for prebuilt binaries. Set
CFLAGS, LDFLAGS, and PKG_CONFIG_PATH via sessionVariables so
configure scripts find zlib, openssl, readline, etc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-02-18 15:46:24 -08:00
commit a295298366

View file

@ -1,5 +1,9 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
# Libraries needed by mise-compiled runtimes (python-build, etc.)
buildDeps = with pkgs; [ zlib readline bzip2 xz libffi ncurses sqlite openssl ];
in
{
# Allow unfree packages (NVIDIA drivers, Steam)
nixpkgs.config.allowUnfree = true;
@ -138,17 +142,14 @@
# Allow running dynamically linked binaries (mise-installed runtimes, etc.)
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
icu
openssl
zlib
readline
bzip2
xz
libffi
ncurses
sqlite
];
programs.nix-ld.libraries = buildDeps ++ [ pkgs.icu ];
# Compile-time flags for mise python-build and similar source builds
environment.sessionVariables = {
PKG_CONFIG_PATH = lib.makeSearchPath "lib/pkgconfig" (map lib.getDev buildDeps);
CFLAGS = lib.concatMapStringsSep " " (p: "-I${lib.getDev p}/include") buildDeps;
LDFLAGS = lib.concatMapStringsSep " " (p: "-L${lib.getLib p}/lib") buildDeps;
};
# Fonts
fonts.packages = with pkgs; [