summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus T. Aehlig <aehlig@linta.de>2025-06-14 14:35:26 +0200
committerKlaus T. Aehlig <aehlig@linta.de>2025-06-16 12:55:48 +0200
commit9e4e676260aa3205a79f0e8d280fb957f65eb89d (patch)
tree3b5f7c682377f3ef0125a3218361b6c931ddfb2a
parenta671faaa5cc432011ff60c0765042bc285ab9896 (diff)
downloadbootstrappable-toolchain-9e4e676260aa3205a79f0e8d280fb957f65eb89d.tar.gz
Documentation: describe how to programatically obtain host paths on NixOS
-rw-r--r--README.md3
-rw-r--r--doc/host-config.nix30
2 files changed, 33 insertions, 0 deletions
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
+ '';
+
+}