Add a flake for a dev shell

This commit is contained in:
Rotem Horesh 2025-01-30 22:37:49 +02:00 committed by GitHub
parent 30ee9d024d
commit fe41b3e760
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,3 +33,49 @@ pkgs.mkShell rec {
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs; builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
} }
``` ```
Alternatively, you can use this `flake.nix` to create a dev shell, activated by `nix develop`:
```nix
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
};
buildInputs = with pkgs; [
expat
fontconfig
freetype
freetype.dev
libGL
pkg-config
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
wayland
libxkbcommon
];
in {
devShells.default = pkgs.mkShell {
inherit buildInputs;
LD_LIBRARY_PATH =
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
};
}
);
}
```