aboutsummaryrefslogtreecommitdiffstats
path: root/shell.nix
blob: 7e73840887151f9250968220c697cd65b48ec523 (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
{ pkgs ? import (import ./nix/sources.nix).nixpkgs {
    overlays = [
      (self: super: {
        "format" = pkgs.writers.writeDashBin "format" ''
          set -efu
          cd ${self.lib.escapeShellArg (toString ./.)}
          find src -iname '*.rs' -exec ${pkgs.rustfmt}/bin/rustfmt '{}' \;
        '';
        "watch" = pkgs.writers.writeDashBin "watch" ''
          set -efu
          cd ${self.lib.escapeShellArg (toString ./.)}
          find src -iname '*.rs' | entr -rs 'clear; cargo check'
        '';
      })
    ];
  }
}:
let inherit (pkgs) lib; in
pkgs.mkShell rec {
  nativeBuildInputs = [
    pkgs.cargo
    pkgs.format
    pkgs.pkg-config
    pkgs.rustc
    pkgs.rustfmt
    pkgs.watch
  ];
  buildInputs = [
    pkgs.alsa-lib
    pkgs.libxkbcommon
    pkgs.udev
    pkgs.vulkan-loader
    pkgs.wayland
    pkgs.xorg.libX11
    pkgs.xorg.libXcursor
    pkgs.xorg.libXi
    pkgs.xorg.libXrandr
  ];
  LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
}