Add alsa-lib to shell.nix and flake.nix for audio support Reference: https://github.com/mackron/miniaudio/issues/267#issuecomment-770345648

replicaCortex
2025-08-07 19:46:02 +03:00
parent 1562b91e7b
commit 0aa871e571

@ -227,14 +227,19 @@ tar xvf external/5.5.tar.gz -C external/
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
}; };
outputs = { self , nixpkgs ,... }: let outputs = {
self,
nixpkgs,
...
}: let
system = "x86_64-linux"; system = "x86_64-linux";
in { in {
devShells."${system}".default = let devShells."${system}".default = let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
}; };
in pkgs.mkShell { in
pkgs.mkShell {
packages = [ packages = [
pkgs.libGL pkgs.libGL
@ -249,6 +254,9 @@ tar xvf external/5.5.tar.gz -C external/
# Uncomment the line below if you want to build Raylib with web support # Uncomment the line below if you want to build Raylib with web support
# pkgs.emscripten # pkgs.emscripten
]; ];
# Audio dependencies
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.alsa-lib];
}; };
}; };
} }
@ -265,7 +273,6 @@ nix develop
Alternatively, you can create a `shell.nix` file in the root folder of your project with the following content: Alternatively, you can create a `shell.nix` file in the root folder of your project with the following content:
```nix ```nix
{pkgs ? import <nixpkgs> {}}: {pkgs ? import <nixpkgs> {}}:
pkgs.mkShell { pkgs.mkShell {
nativeBuildInputs = [ nativeBuildInputs = [
pkgs.libGL pkgs.libGL
@ -281,6 +288,9 @@ Alternatively, you can create a `shell.nix` file in the root folder of your proj
# Web support (uncomment to enable) # Web support (uncomment to enable)
# pkgs.emscripten # pkgs.emscripten
]; ];
# Audio dependencies
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.alsa-lib];
} }
``` ```