Repository navigation
Add NixOS flake support #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| { | ||
| description = "OpenMouse Bridge for NixOS"; | ||
|
|
||
| inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
|
|
||
| outputs = { self, nixpkgs }: | ||
| let | ||
| systems = [ "x86_64-linux" "aarch64-linux" ]; | ||
| eachSystem = nixpkgs.lib.genAttrs systems; | ||
| in { | ||
| packages = eachSystem (system: | ||
| let | ||
| pkgs = import nixpkgs { inherit system; }; | ||
| nativeHid = pkgs.buildNpmPackage { | ||
| pname = "openmouse-bridge-native-hid"; | ||
| version = "0.1.0"; | ||
| src = "${self}/native-hid"; | ||
| npmDepsHash = "sha256-JMsspevf1MunaufbYZY2t8kCX6WuxowlFi4wKn/F1Qw="; | ||
| makeCacheWritable = true; | ||
| forceGitDeps = true; | ||
| npmInstallFlags = [ "--ignore-scripts=false" ]; | ||
| nativeBuildInputs = with pkgs; [ nodejs_24 pkg-config python3 ]; | ||
| buildInputs = with pkgs; [ libusb1 systemd ]; | ||
| dontNpmBuild = true; | ||
| }; | ||
| bridge = pkgs.rustPlatform.buildRustPackage { | ||
| pname = "openmouse-bridge"; | ||
| version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; | ||
| src = self; | ||
| cargoLock.lockFile = ./Cargo.lock; | ||
| nativeBuildInputs = with pkgs; [ pkg-config cmake clang makeWrapper ]; | ||
| buildInputs = with pkgs; [ | ||
| openssl systemd wayland libxkbcommon | ||
| libX11 libxcb libGL fontconfig freetype alsa-lib vulkan-loader | ||
| ]; | ||
| postInstall = '' | ||
| mkdir -p $out/bin/native-hid $out/share/openmouse-bridge $out/share/icons/hicolor/512x512/apps $out/share/applications | ||
| cp -r ${self}/native-hid/. $out/bin/native-hid/ | ||
| cp -r ${nativeHid}/lib/node_modules/openmouse-bridge-native-hid/node_modules $out/bin/native-hid/ | ||
| mkdir -p $out/bin/native-hid/node/bin | ||
| cp -r ${self}/assets/. $out/share/openmouse-bridge/ | ||
| ln -s ${pkgs.nodejs_24}/bin/node $out/bin/native-hid/node/bin/node | ||
| cp ${self}/assets/openmouse-app-icon.png $out/share/icons/hicolor/512x512/apps/io.openmouse.bridge.png | ||
| cat > $out/share/applications/io.openmouse.bridge.desktop <<'DESKTOP' | ||
| [Desktop Entry] | ||
| Type=Application | ||
| Name=OpenMouse Bridge | ||
| Comment=Local companion for the OpenMouse control panel | ||
| Exec=$out/bin/openmouse-bridge | ||
| Icon=io.openmouse.bridge | ||
| Categories=Utility; | ||
| Terminal=false | ||
| DESKTOP | ||
| wrapProgram $out/bin/openmouse-bridge \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Autostart launches the wrapper's hidden binary, which lacks the wrapper's library paths.
Manual launch through
|
||
| --prefix LD_LIBRARY_PATH : ${pkgs.lib.makeLibraryPath [ | ||
| pkgs.systemd pkgs.wayland pkgs.libxkbcommon | ||
| pkgs.libX11 pkgs.libxcb pkgs.libGL pkgs.fontconfig pkgs.freetype | ||
| pkgs.alsa-lib pkgs.vulkan-loader pkgs.libusb1 pkgs.stdenv.cc.cc.lib | ||
| ]} \ | ||
| --prefix XDG_DATA_DIRS : /run/opengl-driver/share | ||
| ''; | ||
| meta = with pkgs.lib; { | ||
| description = "Local native HID and desktop companion for OpenMouse"; | ||
| homepage = "https://openmouse.app/"; | ||
| license = licenses.mit; | ||
| platforms = platforms.linux; | ||
| mainProgram = "openmouse-bridge"; | ||
| }; | ||
| }; | ||
| in { | ||
| default = bridge; | ||
| openmouse-bridge = bridge; | ||
| }); | ||
|
|
||
| apps = eachSystem (system: { | ||
| default = { | ||
| type = "app"; | ||
| program = "${self.packages.${system}.default}/bin/openmouse-bridge"; | ||
| }; | ||
| }); | ||
| }; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High
flake.nix:44The installed
.desktopfile contains the literalExec=$out/bin/openmouse-bridge, so launching OpenMouse Bridge from the application menu fails. The quoted heredoc delimiter prevents shell expansion of$out; remove the quotes so the output path is written into the launcher.🤖 Copy this AI Prompt to have your agent fix this: