Skip to content

Commit 9b1e10e

Browse files
samestepsaipraveenb25expipiplus1
authored
Add Nix flake for direnv (shader-slang#6635)
* Add Nix flake for direnv * Use Sai's suggestion for the `description` * Make `.envrc` optional * Move Nix docs to their own section * Tweak wording * Tweak wording more * Add `nixfmt` --------- Co-authored-by: Sai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
1 parent de6cc94 commit 9b1e10e

File tree

4 files changed

+110
-0
lines changed

4 files changed

+110
-0
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
*.zip
1313
*.ini
1414
*.DS_store
15+
.direnv
16+
.envrc
1517
.gdb_history
1618
.vimspector
1719
.vimspector.json

docs/building.md

+14
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,20 @@ cmake --preset vs2022 --fresh -A arm64 -DSLANG_GENERATORS_PATH=generators/bin
311311
cmake --build --preset release
312312
```
313313

314+
### Nix
315+
316+
This repository contains a [Nix](https://nixos.org/)
317+
[flake](https://wiki.nixos.org/wiki/Flakes) (not officially supported or
318+
tested), which provides the necessary prerequisites for local development. Also,
319+
if you use [direnv](https://direnv.net/), you can run the following commands to
320+
have the Nix environment automatically activate when you enter your clone of
321+
this repository:
322+
323+
```bash
324+
echo 'use flake' >> .envrc
325+
direnv allow
326+
```
327+
314328
## Building with an older CMake
315329

316330
Because older CMake versions don't support all the features we want to use in

flake.lock

+61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
description = "The Slang Shading Language and Compiler";
3+
inputs = {
4+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
flake-utils.url = "github:numtide/flake-utils";
6+
};
7+
outputs =
8+
{
9+
self,
10+
nixpkgs,
11+
flake-utils,
12+
}:
13+
flake-utils.lib.eachDefaultSystem (
14+
system:
15+
let
16+
pkgs = import nixpkgs { inherit system; };
17+
in
18+
{
19+
devShell =
20+
with pkgs;
21+
mkShell {
22+
buildInputs = [
23+
cmake
24+
llvm
25+
ninja
26+
nixfmt-rfc-style
27+
python3
28+
xorg.libX11
29+
];
30+
};
31+
}
32+
);
33+
}

0 commit comments

Comments
 (0)