gardesk/gar / 6cf0f1e

Browse files

dev things

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
6cf0f1ea27f579602e889f135aa1d56c1e58f24a
Parents
a024670
Tree
2aaf5e6

2 changed files

StatusFile+-
A flake.nix 65 0
A shell.nix 28 0
flake.nixadded
@@ -0,0 +1,65 @@
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
+}
shell.nixadded
@@ -0,0 +1,28 @@
1
+{ pkgs ? import <nixpkgs> {} }:
2
+
3
+pkgs.mkShell {
4
+  buildInputs = with pkgs; [
5
+    rustc
6
+    cargo
7
+    pkg-config
8
+
9
+    # X11 dependencies
10
+    xorg.libX11
11
+    xorg.libXcursor
12
+    xorg.libXrandr
13
+    xorg.libXi
14
+    xorg.libxcb
15
+
16
+    # For testing in nested X
17
+    xorg.xorgserver
18
+  ];
19
+
20
+  shellHook = ''
21
+    echo "gar development shell"
22
+    echo "Run 'cargo build' to build"
23
+    echo "Test with: Xephyr -br -ac -noreset -screen 1280x720 :1 &"
24
+    echo "Then: DISPLAY=:1 cargo run"
25
+  '';
26
+
27
+  RUST_BACKTRACE = "1";
28
+}