clean up devShell templates
This commit is contained in:
parent
a81f0a2459
commit
da6e292879
1 changed files with 59 additions and 50 deletions
109
DEPENDENCIES.md
109
DEPENDENCIES.md
|
|
@ -11,26 +11,33 @@ get them, if your system isn't here, add it!
|
||||||
You can add this `shell.nix` to your project and use it by running `nix-shell`:
|
You can add this `shell.nix` to your project and use it by running `nix-shell`:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
|
||||||
pkgs.mkShell rec {
|
let
|
||||||
buildInputs = with pkgs; [
|
dlopenLibraries = with pkgs; [
|
||||||
expat
|
|
||||||
fontconfig
|
|
||||||
freetype
|
|
||||||
freetype.dev
|
|
||||||
libGL
|
|
||||||
pkg-config
|
|
||||||
xorg.libX11
|
|
||||||
xorg.libXcursor
|
|
||||||
xorg.libXi
|
|
||||||
xorg.libXrandr
|
|
||||||
wayland
|
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
|
|
||||||
|
# GPU backend
|
||||||
|
vulkan-loader
|
||||||
|
# libGL
|
||||||
|
|
||||||
|
# Window system
|
||||||
|
wayland
|
||||||
|
# xorg.libX11
|
||||||
|
# xorg.libXcursor
|
||||||
|
# xorg.libXi
|
||||||
|
];
|
||||||
|
in pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cargo
|
||||||
|
rustc
|
||||||
];
|
];
|
||||||
|
|
||||||
LD_LIBRARY_PATH =
|
# additional libraries that your project
|
||||||
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
|
# links to at build time, e.g. OpenSSL
|
||||||
|
buildInputs = [];
|
||||||
|
|
||||||
|
env.RUSTFLAGS = "-C link-arg=-Wl,-rpath,${pkgs.lib.makeLibraryPath dlopenLibraries}";
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -39,43 +46,45 @@ Alternatively, you can use this `flake.nix` to create a dev shell, activated by
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
systems.url = "github:nix-systems/default";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = { nixpkgs, systems, ... }:
|
||||||
nixpkgs,
|
let
|
||||||
flake-utils,
|
eachSystem = nixpkgs.lib.genAttrs (import systems);
|
||||||
...
|
pkgsFor = nixpkgs.legacyPackages;
|
||||||
}:
|
in {
|
||||||
flake-utils.lib.eachDefaultSystem (
|
devShells = eachSystem (system:
|
||||||
system: let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = pkgsFor.${system};
|
||||||
inherit system;
|
dlopenLibraries = with pkgs; [
|
||||||
};
|
libxkbcommon
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
# GPU backend
|
||||||
expat
|
vulkan-loader
|
||||||
fontconfig
|
# libGL
|
||||||
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 =
|
# Window system
|
||||||
builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" buildInputs;
|
wayland
|
||||||
};
|
# xorg.libX11
|
||||||
}
|
# xorg.libXcursor
|
||||||
);
|
# xorg.libXi
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
cargo
|
||||||
|
rustc
|
||||||
|
];
|
||||||
|
|
||||||
|
# additional libraries that your project
|
||||||
|
# links to at build time, e.g. OpenSSL
|
||||||
|
buildInputs = [];
|
||||||
|
|
||||||
|
env.RUSTFLAGS = "-C link-arg=-Wl,-rpath,${nixpkgs.lib.makeLibraryPath dlopenLibraries}";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue