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

keyd: init at 2.2.5-beta and Keyd module #158793

Merged
merged 0 commits into from
Aug 18, 2022
Merged

Conversation

cidkidnix
Copy link
Contributor

@cidkidnix cidkidnix commented Feb 9, 2022

Expands on #158489, and allows for the per-application keyd experiment to work
Also closes #132474.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Feb 9, 2022
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Feb 9, 2022
@cidkidnix cidkidnix changed the title init: keyd 2.2.5-beta and Keyd module keyd: init at 2.2.5-beta and Keyd module Feb 10, 2022
Copy link
Member

@dit7ya dit7ya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for submitting this PR!

Have not built it myself but left some general comments. Also, I am not sure if this belongs to the hardware directory. I don't know have a strong opinion for any other directory though.

};

configuration = mkOption {
type = types.lines;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to allow a config file path as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly filepath since keyd expects it's configs under /etc/keyd but I've made it possible to have multiple config files in the latest commit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it needs a directory containing files passed to it rather than a specific file, there still isn't anything wrong with setting this to types.path.

pkgs/tools/inputmethods/keyd/default.nix Outdated Show resolved Hide resolved
maintainers = [ "cidkid" ];
};

options = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth adding options applicationSpecificMapping.enable and applicationSpecificMapping.config if you are building it with Python (which is not required for the base version). Also, I don't see keyd-application-mapper being called anywhere in the systemd service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keyd recommends to use your wm or an autostart to launch keyd-application-mapper, and we can't define it in a declarative way due to the config path being in the users $HOME

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could write a systemd user service (i.e. systemd.user.services.keyd-application-mapper)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are users created here and now talks of running it as a user service. If it can run as a user service, it definitely doesn't need a hardcoded user.

@foolnotion
Copy link
Contributor

I've been using this for over a month and it works great. It would be awesome to see it merged.

@tgharib tgharib mentioned this pull request Apr 17, 2022
13 tasks
nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
default = {};

description = ''
What the filename should be for configuration files for keyd (Multiple are allowed in keyd)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description is a little confusing. Also can you add an example?

nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
configuration = mkOption {
type = types.attrsOf (types.submodule ({ config, options, ... }: {
options = {
text = mkOption {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you gain anything by making this a submodule instead of just making it a listOf? The name of the config file is largely irrelevant, isn't it? Also I'd prefer making this a lisfOf path, to have the config in a separate file, but that's just personal preference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any point to allowing multiple configuration files? That sounds like an implementation detail to me...

Additionally, is there any way we can accept a nix attribute set for the actual configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dit7ya requested the ability to have multiple config files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what is the reason for multiple files? @aanderse's point about passing an attrset is also valid.

pkgs/tools/inputmethods/keyd/default.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 9, 2022
Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add changelog entry as contributing document states.


config = mkIf cfg.enable {
users.groups.keyd = {
gid = 994;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is seeing a gid necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not certain, I believe there was a reason before although I can't find it

Copy link
Member

@aanderse aanderse May 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a community rfc stating not to use uid and gid unless explicitly necessary. So see if you can remember or not.

nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
configuration = mkOption {
type = types.attrsOf (types.submodule ({ config, options, ... }: {
options = {
text = mkOption {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any point to allowing multiple configuration files? That sounds like an implementation detail to me...

Additionally, is there any way we can accept a nix attribute set for the actual configuration?

nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
};
};
};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final new line

Copy link
Contributor

@edrex edrex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

I tested with the changes below and it works for me.

I wish upstream didn't take a hard line about restricting config paths to /etc/keyd (rvaiya/keyd#70); that is rather idiosyncratic. Ah well.

Let's get this merged!

nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
nixos/modules/services/hardware/keyd.nix Outdated Show resolved Hide resolved
pkgs/tools/inputmethods/keyd/default.nix Outdated Show resolved Hide resolved
pkgs/tools/inputmethods/keyd/default.nix Outdated Show resolved Hide resolved
@cidkidnix
Copy link
Contributor Author

cidkidnix commented Jun 22, 2022

Sorry about the long-wait on this, I've been busy!

@dit7ya dit7ya mentioned this pull request Jul 13, 2022
13 tasks
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-bring-karabiner-elements-to-nixos/21011/7

@pdelfino
Copy link

Thanks for the work! This PR was mentioned in this discussion on NixOS official Discourse.

@cidkidnix cidkidnix merged commit bb3b4db into NixOS:master Aug 18, 2022
@cidkidnix
Copy link
Contributor Author

This isn't closed, just accidentally updated my local nixpkgs tree and forced pushed, oops

@cidkidnix
Copy link
Contributor Author

https://github.com/cidkidnix/nixpkgs/tree/cidkidnix/keyd,
New tree, sorry about that

@benide
Copy link

benide commented Aug 18, 2022

You might need to open a new PR if my understanding of how github works is correct.

edrex added a commit to edrex/nixos-config that referenced this pull request Dec 30, 2022
edrex added a commit to edrex/nixos-config that referenced this pull request Dec 30, 2022
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-get-the-service-running-for-keyd/24991/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

package request: keyd - "A key remapping daemon for linux"