Skip to content
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

services.karabiner-elements is broken after Karabiner-Elements v15.0 #1041

Open
rayssd opened this issue Aug 23, 2024 · 5 comments
Open

services.karabiner-elements is broken after Karabiner-Elements v15.0 #1041

rayssd opened this issue Aug 23, 2024 · 5 comments

Comments

@rayssd
Copy link

rayssd commented Aug 23, 2024

Hi,

After Karabiner-Elements v15.0, a darwin-rebuild causes the following error:

setting up user launchd services...
creating user service org.nixos.activate_karabiner_system_ext
creating user service org.pqrs.karabiner.agent.karabiner_grabber
cp: cannot stat '/nix/store/fkjp2mw8rmysra1fg3yxcm5n72am4309-launchd/user/Library/LaunchAgents/org.pqrs.karabiner.agent.karabiner_grabber.plist': No such file or directory

Upon inspection, /nix/store/fkjp2mw8rmysra1fg3yxcm5n72am4309-launchd/user/Library/LaunchAgents/org.pqrs.karabiner.agent.karabiner_grabber.plist links to ${pkgs.karabiner-elements}/Library/LaunchAgents/org.pqrs.karabiner.agent.karabiner_observer.plist

The symlinks above are created here:

environment.userLaunchAgents."org.pqrs.karabiner.agent.karabiner_grabber.plist".source = "${pkgs.karabiner-elements}/Library/LaunchAgents/org.pqrs.karabiner.agent.karabiner_grabber.plist";
environment.userLaunchAgents."org.pqrs.karabiner.agent.karabiner_observer.plist".source = "${pkgs.karabiner-elements}/Library/LaunchAgents/org.pqrs.karabiner.agent.karabiner_observer.plist";
environment.userLaunchAgents."org.pqrs.karabiner.karabiner_console_user_server.plist".source = "${pkgs.karabiner-elements}/Library/LaunchAgents/org.pqrs.karabiner.karabiner_console_user_server.plist";

${pkgs.karabiner-elements}/Library/LaunchAgents/ is no longer a valid path because the folder LaunchAgents no longer exists in v15.0

It appears this is not the only breaking change though. It seems installing Karabiner-Elements v15.0 using brew introduces two new apps "Karabiner-Elements Non-Priviledged Agent.app" and "Karabiner-Elements Priviledged Daemons.app" in Login Items which weren't there before v15.0.

@utkarshgupta137
Copy link

Did you find any workarounds for this or a way to downgrade karabiner in nixpkgs?

@n8henrie
Copy link
Contributor

n8henrie commented Sep 2, 2024

@utkarshgupta137 it shouldn't require anything special, something like this is working fine for me (where nixpkgs-stable is a flake input pinned to 24.05).

  nixpkgs.overlays = [
    (_: prev: {
      # https://github.com/LnL7/nix-darwin/issues/1041
      inherit (inputs.nixpkgs-stable.legacyPackages.${prev.system}) karabiner-elements;
    })
  ];

@ofalvai
Copy link

ofalvai commented Sep 2, 2024

I decided to set nix-darwin to follow the stable nixpkgs channel and use the 14.x Karabiner. This was a good reminder for me that OS-level things like nix-darwin should not use unstable packages.

Relevant part of my flake.nix:

nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
nix-darwin = {
  url = "github:LnL7/nix-darwin";
  inputs.nixpkgs.follows = "nixpkgs-stable";
};

@emilazy
Copy link
Collaborator

emilazy commented Sep 2, 2024

I haven’t had the time to look into this but I’d review a PR fixing the module. It would need some conditionals around the package version to support multiple releases (I must cut branches soon…). I wouldn’t say this is particularly an unstable channel thing since it might still be broken by 24.11’s release if nobody gets around to fixing the module.

@mvillafuertem
Copy link

@ofalvai thanks it's a nice workaround

I decided to set nix-darwin to follow the stable nixpkgs channel and use the 14.x Karabiner. This was a good reminder for me that OS-level things like nix-darwin should not use unstable packages.

Relevant part of my flake.nix:

nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
nix-darwin = {
  url = "github:LnL7/nix-darwin";
  inputs.nixpkgs.follows = "nixpkgs-stable";
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants