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

nixos/buffyboard: init #358941

Merged
merged 2 commits into from
Dec 7, 2024
Merged

nixos/buffyboard: init #358941

merged 2 commits into from
Dec 7, 2024

Conversation

uninsane
Copy link
Contributor

buffyboard is the On-Screen Keyboard (OSK) provided by postmarketOS's buffybox project. unlike X- or Wayland-based OSKs, buffyboard renders directly to the framebuffer and injects events via libinput: this allows it to run without any Desktop Environment. the primary use-case is to make the native TTY system accessible to keyboard-less devices such as Linux tablets and mobile phones.


  • the package can be tested with nix-build -A buffybox && sudo ./result/bin/buffyboard; then tab to an unused TTY (e.g. Ctrl+Alt+F2) and use the mouse/touchpad/touchscreen to use the virtual keyboard. if no on-screen keyboard is visible, click the bottom of the TTY to force a redraw.
  • the service can be tested in the same manner after setting services.buffyboard.enable = true. a reboot or systemctl start buffyboard.service may be required.

pleases see the note in nixos/modules/services/hardware/buffyboard.nix for tips to make the experience more enjoyable if deploying to a device that also runs a desktop environment.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

[buffybox](https://gitlab.postmarketos.org/postmarketOS/buffybox/) is a
suite of graphical applications for the terminal.
notably for nixpkgs, this includes `buffyboard`: an on-screen
framebuffer keyboard especially useful for touch-only devices like
mobile phones.

`buffyboard` can be built and launched (as root) with no arguments: then
tab to an unused TTY (e.g. Ctrl+Alt+F2) where an on-screen keyboard should
now be visible (if not, try clicking in the bottom of the terminal to force a redraw).

further configuration of buffyboard is possible by editing
`/etc/buffyboard.conf` or passing CLI flags.
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation This PR adds or changes documentation 8.has: changelog 8.has: module (update) This PR changes an existing module in `nixos/` labels Nov 25, 2024
Copy link
Contributor

@Luflosi Luflosi left a comment

Choose a reason for hiding this comment

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

Thank you for packaging this!

I left a couple small comments but the code looks very good and is pretty much ready to merge as far as I'm concerned.

postmarketOS has a cool feature on the PinePhone, where you can hold a volume button and press the power button three times to get to a shell if the GUI is not responding. This package and module are the first step towards bringing this feature to NixOS. What's your use-case or motivation for this package and module?

Comment on lines +10 to +14
# Desktop users are recommended to either:
# 1. Stop buffyboard once your DE is started.
# e.g. `services.buffyboard.unitConfig.Conflicts = [ "my-de.service" ];`
# 2. Configure your DE to ignore input events from buffyboard (product-id=25209; vendor-id=26214; name=rd)
# e.g. `echo 'input "26214:25209:rd" events disabled' > ~/.config/sway/config`
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be too much work to implement at least one of these options for every DE in Nixpkgs?

Copy link
Contributor

@hustlerone hustlerone Nov 26, 2024

Choose a reason for hiding this comment

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

There's not much of a standard for DE's. In fact, pmOS does not use buffyboard outside of tty and since they're quite niche they have the freedom to fiddle with DE's a bit

Comment on lines +53 to +59
meta = with lib; {
description = "A suite of graphical applications for the terminal";
homepage = "https://gitlab.postmarketos.org/postmarketOS/buffybox";
license = licenses.gpl3Plus;
maintainers = with lib.maintainers; [ colinsane ];
platforms = platforms.linux;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that in your opinion buffyboard can not be considered the main program since one may also want to use unl0kr. Is that correct? Just making sure that you deliberately did not specify meta.mainProgram.

Copy link
Contributor

Choose a reason for hiding this comment

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

Btw. is there any relation between unl0kr from this package and the unl0kr package, which is already in Nixpkgs?

Copy link
Contributor

@hustlerone hustlerone Nov 26, 2024

Choose a reason for hiding this comment

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

yes, unl0kr has been part of this suite for quite a while already

Copy link
Contributor

@hustlerone hustlerone Nov 26, 2024

Choose a reason for hiding this comment

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

in fact, if this gets merged I'll gladly remove the unl0kr package and change the service so it looks for the unl0kr binary (since buffybox includes both)

@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Nov 26, 2024
@uninsane
Copy link
Contributor Author

What's your use-case or motivation for this package and module?

@Luflosi i use it as a greeter. previously i piped unl0kr into login for similar effect but unl0kr really isn't meant for that and would output my password to the console if i ever messed up.

the larger demand for this package seems to be as a debugging tool. @MatthewCroughan wanted to review my Bonsai PR, but without a working DE that's difficult to debug on the phone. a TTY keyboard lets you debug things when you're refactoring the DE itself, it's even more useful during device bringup, when porting new devices.

postmarketOS has a cool feature on the PinePhone, where you can hold a volume button and press the power button three times to get to a shell if the GUI is not responding.

for anyone interested, that would be TTYescape. have not looked into that but would be a happy user/tester if anyone pursues that :)

[buffyboard](https://gitlab.postmarketos.org/postmarketOS/buffybox/-/tree/master/buffyboard)
is the on-screen framebuffer keyboard provided by postmarketOS's
buffybox project.

enable this with `services.buffybox.enable = true;`: any additional
settings are strictly optional.

once enabled, tab to an unused TTY (e.g. Ctrl+Alt+F2) and use the
mouse/touchpad/touchscreen to use the virtual keyboard. may require
a manual `systemctl start buffybox` if enabled on an already-booted
device.

Co-authored-by: Luflosi <[email protected]>
@h7x4 h7x4 added the 8.has: module (new) This PR adds a module in `nixos/` label Nov 27, 2024
@hustlerone hustlerone mentioned this pull request Dec 4, 2024
13 tasks
@ElvishJerricco
Copy link
Contributor

So, we already have an unl0kr package / module, which supports entering LUKS passwords during boot. I think this PR probably needs to replace those with this.

@uninsane
Copy link
Contributor Author

uninsane commented Dec 4, 2024

So, we already have an unl0kr package / module, which supports entering LUKS passwords during boot. I think this PR probably needs to replace those with this.

i tried to bump unl0kr in the past. there were some hardware-specific issues, the type where debugging requires more resources than i have, nor is the current maintainer able to assist (edit: i see maintainership has been passed to hustlerone so this is probably less of an issue now).

i agree with the direction -- to migrate the unl0kr service over to buffybox. @hustlerone proposed to do that work after this PR. i think that's perfectly fine. i would suggest adding a package argument to the unl0kr service, switching the default over to buffybox, and then giving a few months for the hardware-specific bugs to be ironed out during which users can fallback to the unl0kr 2.0.0 package, before removing that.

whatever the case, i don't want to do the unl0kr stuff as part of this PR: trying to coordinate that much in one PR is not realistic IMO.

@uninsane
Copy link
Contributor Author

uninsane commented Dec 4, 2024

#361865 should allow people to experiment with porting the unl0kr service over to buffybox.

@hustlerone
Copy link
Contributor

So, we already have an unl0kr package / module, which supports entering LUKS passwords during boot. I think this PR probably needs to replace those with this.

I agree that both are kind of two sides of the same coin and are distributed by the same package but it's out of the scope of this PR (since buffyboard is for TTY and unl0kr is for unlocking disks on boot).

After this PR goes through I'll look on testing the buffybox package (the unl0kr binary), since there seems to be a patch regarding DRM (in which maybe we won't need to restrict early video loading anymore) in the current rev

@ElvishJerricco ElvishJerricco merged commit 5c8a2ca into NixOS:master Dec 7, 2024
35 of 36 checks passed
@ElvishJerricco
Copy link
Contributor

@hustlerone Please do look into removing the other unl0kr package and using this one for the unl0kr module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants