{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs }: let systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" "riscv64-linux" ]; eachSystem = f: nixpkgs.lib.genAttrs systems ( system: f { inherit system; pkgs = import nixpkgs { inherit system; }; } ); in { devShells = eachSystem ( { system, pkgs }: let inherit (pkgs) pkgsStatic pkg-config gnumake lldb clang bintools xxd; inherit (pkgsStatic) tinycc; stdenv = pkgs.llvmPackages.stdenv; mkShell = pkgs.mkShell.override { inherit stdenv; }; musl-src = pkgs.runCommand "musl-src" { } '' mkdir $out tar -xf ${pkgs.musl.src} -C $out ''; musl = pkgs.musl.overrideAttrs (attrs: { # this HAS the be fixed in upstream nixpkgs one day, right? CFLAGS = attrs.CFLAGS ++ [ "-fdebug-prefix-map=/build=${musl-src}" ]; seperateDebugInfo = false; dontStrip = true; }); in { default = mkShell { buildInputs = [ musl tinycc ]; nativeBuildInputs = [ pkg-config gnumake lldb clang bintools xxd ]; MUSL_LIB = "${musl}"; MUSL_DEV = "${musl.dev}"; MUSL_SRC = "${musl-src}"; }; } ); }; }