Nix · 2664 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 # TLS
36 openssl
37 ];
38
39 rustToolchain = pkgs.rust-bin.stable.latest.default.override {
40 extensions = [ "rust-src" "rust-analyzer" ];
41 };
42 in
43 {
44 # Development shell
45 devShells.default = pkgs.mkShell {
46 buildInputs = buildDeps ++ libDeps ++ [
47 rustToolchain
48 ];
49
50 # Set up pkg-config paths
51 PKG_CONFIG_PATH = pkgs.lib.makeSearchPath "lib/pkgconfig" libDeps;
52
53 # For wayland-scanner
54 WAYLAND_PROTOCOLS = "${pkgs.wayland-protocols}/share/wayland-protocols";
55
56 shellHook = ''
57 echo "HyprKVM development shell"
58 echo "Rust: $(rustc --version)"
59 echo ""
60 echo "Run 'cargo build' to compile"
61 '';
62 };
63
64 # Package
65 packages.default = pkgs.rustPlatform.buildRustPackage {
66 pname = "hyprkvm";
67 version = "0.5.0";
68 src = ./.;
69
70 cargoLock = {
71 lockFile = ./Cargo.lock;
72 };
73
74 nativeBuildInputs = buildDeps;
75 buildInputs = libDeps;
76
77 # Builds both hyprkvm (daemon) and hyprkvm-ctl (CLI)
78 # buildRustPackage automatically installs all workspace binaries
79
80 meta = with pkgs.lib; {
81 description = "Hyprland-native software KVM switch";
82 longDescription = ''
83 HyprKVM enables seamless keyboard/mouse control transfer between
84 Linux machines running Hyprland. Move past your last workspace
85 to switch to another machine.
86 '';
87 homepage = "https://github.com/tenseleyFlow/hyprKVM";
88 license = licenses.mit;
89 platforms = platforms.linux;
90 mainProgram = "hyprkvm";
91 };
92 };
93 }
94 );
95 }