summaryrefslogtreecommitdiffstats
path: root/flake.nix
blob: 464856a4a20a388bb476d72a06ada66662b7fe12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  description = "The Slang Shading Language and Compiler";
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };
  outputs =
    {
      self,
      nixpkgs,
      flake-utils,
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      {
        # We want to use Clang instead of GCC because it seems to behave better
        # with LLDB, so we use `mkShellNoCC` here instead of `mkShell` because
        # the latter brings in GCC by default on Linux.
        devShell = pkgs.mkShellNoCC {
          buildInputs = [
            # We must list clangd before the `clang` package to make sure it
            # comes earlier on the `PATH`, and we must get it from the
            # `clang-tools` package so that it is wrapped properly.
            (pkgs.linkFarm "clangd-21" [
              {
                name = "bin/clangd";
                # New enough to support `HeaderInsertion: Never` in `.clangd`.
                path = "${pkgs.llvmPackages_21.clang-tools}/bin/clangd";
              }
            ])
            (pkgs.linkFarm "clang-format-17" [
              {
                name = "bin/clang-format";
                # Match the clang-format version used in CI.
                path = "${pkgs.llvmPackages_17.clang-tools}/bin/clang-format";
              }
            ])

            pkgs.clang
            pkgs.cmake
            pkgs.gersemi
            pkgs.lldb
            pkgs.ninja
            pkgs.nixfmt-rfc-style
            pkgs.prettier
            pkgs.python3
            pkgs.shfmt
            pkgs.vulkan-loader # Ensure this gets built to use in library path.
            pkgs.xorg.libX11
          ];
          LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
            # In addition to this, running the Vulkan tests on Linux distros
            # other than NixOS may require the use of nixGL:
            # https://github.com/nix-community/nixGL
            pkgs.vulkan-loader
          ];
        };
      }
    );
}