jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
3.08k stars 129 forks source link

Bug: Not deterministic builds on macOS #1209

Open alexandru0-dev opened 3 months ago

alexandru0-dev commented 3 months ago

Requirements

Describe the bug

karabiner-driverkit uses sw_vers command at runtime for macos which leads to not being reproducible and build can fail in sandboxed environments. I've already created an issue on karabiner-driverkit repo (relevant issue).

This is problematic for systems like nix. (see relevant comment, )

Proposed solution

Not relying in runtime commands as sw_vers making it possible to build 2 version kanata based on macos version

A proposed solution would be using feature flags An example would be using driverkit by default (macos version > 10) and usable with (macos version <= 10) building with --no-default-features --features karabiner_kext for example

Draft example of how I "patched" feature flags: Draft kanata diff Draft karabiner_driverkit diff

If you have any ideas do not mind sharing them

Relevant kanata config

No response

To Reproduce

Use a packaging/build system that does sandboxing (I know this happens with Nix, but I assume this could happen with other methods/occasions, for example if sw_vers is not installed/exposed)

Expected behavior

driverkit building correctly

Kanata version

any kanata version >= 1.6.0

Debug logs

No response

Operating system

macOS

Additional context

No response