Nix · 2349 bytes Raw Blame History
1 {
2 description = "HyprKVM - Hyprland-native software KVM switch";
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 pkgs = import nixpkgs {
17 inherit system;
18 overlays = [ rust-overlay.overlays.default ];
19 };
20
21 # Build dependencies
22 buildDeps = with pkgs; [
23 pkg-config
24 ];
25
26 # Runtime/library dependencies
27 libDeps = with pkgs; [
28 # Wayland
29 wayland
30 wayland-protocols
31
32 # For smithay-client-toolkit
33 libxkbcommon
34
35 # For GTK4 GUI (future)
36 gtk4
37 libadwaita
38
39 # TLS
40 openssl
41 ];
42
43 rustToolchain = pkgs.rust-bin.stable.latest.default.override {
44 extensions = [ "rust-src" "rust-analyzer" ];
45 };
46 in
47 {
48 # Development shell
49 devShells.default = pkgs.mkShell {
50 buildInputs = buildDeps ++ libDeps ++ [
51 rustToolchain
52 ];
53
54 # Set up pkg-config paths
55 PKG_CONFIG_PATH = pkgs.lib.makeSearchPath "lib/pkgconfig" libDeps;
56
57 # For wayland-scanner
58 WAYLAND_PROTOCOLS = "${pkgs.wayland-protocols}/share/wayland-protocols";
59
60 shellHook = ''
61 echo "HyprKVM development shell"
62 echo "Rust: $(rustc --version)"
63 echo ""
64 echo "Run 'cargo build' to compile"
65 '';
66 };
67
68 # Package (for later)
69 packages.default = pkgs.rustPlatform.buildRustPackage {
70 pname = "hyprkvm";
71 version = "0.1.0";
72 src = ./.;
73
74 cargoLock = {
75 lockFile = ./Cargo.lock;
76 };
77
78 nativeBuildInputs = buildDeps ++ [ pkgs.wrapGAppsHook4 ];
79 buildInputs = libDeps;
80
81 meta = with pkgs.lib; {
82 description = "Hyprland-native software KVM switch";
83 homepage = "https://github.com/tenseleyFlow/hyprKVM";
84 license = licenses.mit;
85 platforms = platforms.linux;
86 };
87 };
88 }
89 );
90 }