Nix · 1670 bytes Raw Blame History
1 {
2 description = "gar - Tiling window manager with smart splits";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 flake-utils.url = "github:numtide/flake-utils";
7 rust-overlay = {
8 url = "github:oxalica/rust-overlay";
9 inputs.nixpkgs.follows = "nixpkgs";
10 };
11 };
12
13 outputs = { self, nixpkgs, flake-utils, rust-overlay }:
14 flake-utils.lib.eachDefaultSystem (system:
15 let
16 overlays = [ (import rust-overlay) ];
17 pkgs = import nixpkgs {
18 inherit system overlays;
19 };
20
21 rustToolchain = pkgs.rust-bin.stable.latest.default.override {
22 extensions = [ "rust-src" "rust-analyzer" ];
23 };
24 in
25 {
26 devShells.default = pkgs.mkShell {
27 buildInputs = with pkgs; [
28 rustToolchain
29 pkg-config
30
31 # X11 dependencies
32 xorg.libX11
33 xorg.libXcursor
34 xorg.libXrandr
35 xorg.libXi
36 xorg.libxcb
37
38 # For testing
39 xorg.xorgserver # Xephyr
40 ];
41
42 shellHook = ''
43 echo "gar development shell"
44 echo "Run 'cargo build' to build"
45 echo "Run 'cargo run' to start (requires X server)"
46 '';
47
48 RUST_BACKTRACE = 1;
49 };
50
51 packages.default = pkgs.rustPlatform.buildRustPackage {
52 pname = "gar";
53 version = "0.1.0";
54 src = ./.;
55 cargoLock.lockFile = ./Cargo.lock;
56
57 nativeBuildInputs = with pkgs; [ pkg-config ];
58 buildInputs = with pkgs; [
59 xorg.libX11
60 xorg.libxcb
61 ];
62 };
63 }
64 );
65 }