From 9e4e676260aa3205a79f0e8d280fb957f65eb89d Mon Sep 17 00:00:00 2001 From: "Klaus T. Aehlig" Date: Sat, 14 Jun 2025 14:35:26 +0200 Subject: Documentation: describe how to programatically obtain host paths on NixOS --- README.md | 3 +++ doc/host-config.nix | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 doc/host-config.nix diff --git a/README.md b/README.md index 5124a71..c8b618e 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,9 @@ Example configuration for bootstrapping on NixOS (hashes may vary): } ~~~ +On NixOS, the host configuration is most easily obtained using a custom derivation +obtained from a simple [host-configuration package](doc/host-config.nix). + ## Musl Performance Issues Musl has huge allocator contention issues with multithreading. For that reason, diff --git a/doc/host-config.nix b/doc/host-config.nix new file mode 100644 index 0000000..340598e --- /dev/null +++ b/doc/host-config.nix @@ -0,0 +1,30 @@ +{ stdenv +, jo +, coreutils +, gnused +, glibc +}: + +stdenv.mkDerivation rec { + name = "host-config"; + + unpackPhase=''true''; + + nativeBuildInputs = [ glibc jo coreutils gnused ]; + + buildPhase = '' + jo OS=linux \ + ARCH=$(uname -m | sed 's/aarch64/arm64/' ) \ + TOOLCHAIN_CONFIG=$(jo \ + HOST_SYSTEM_HDR_DIR=${glibc.dev}/include \ + HOST_SYSTEM_LIB_DIR=${glibc}/lib \ + HOST_DYNAMIC_LINKER=$(ls ${glibc}/lib/ld-linux-*.so*) \ + ) > host-config.json + ''; + + installPhase = '' + mkdir -p $out/share + cp host-config.json $out/share + ''; + +} -- cgit v1.2.3