{ description = "A Nix-flake-based Zig development environment"; inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; # stable Nixpkgs inputs.zig-overlay.url = "github:mitchellh/zig-overlay"; outputs = { self, zig-overlay, ... }@inputs: let overlays = [ inputs.zig-overlay.overlays.default ]; supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems ( system: f { pkgs = import inputs.nixpkgs { inherit system overlays; }; } ); nativeBuildInputs = pkgs: with pkgs; [ # X11 libraries libx11 libxext libxcursor libxrandr libxfixes libxi libxscrnsaver libxinerama # Wayland wayland wayland-protocols wlr-protocols wayland-scanner libxkbcommon libdecor # OpenGL/rendering libGL libdrm libgbm # Audio libpulseaudio alsa-lib pipewire # Other for SDL3 dbus systemdLibs vulkan-loader sdl3 ]; in { devShells = forEachSupportedSystem ( { pkgs }: { default = pkgs.mkShellNoCC { packages = with pkgs; [ zigpkgs."0.16.0" zls lldb pkg-config ]; nativeBuildInputs = nativeBuildInputs pkgs; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (nativeBuildInputs (pkgs)); }; } ); }; }