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

Initial support for GPD Pocket #48

Closed
wants to merge 1 commit into from

Conversation

lbonn
Copy link

@lbonn lbonn commented Jan 14, 2018

Here is a small number of settings for a reasonably functional system running on a GPD Pocket

Some parts might be out of scope for this repo (the environment variables at the end?). I'll let you be the judge of that: please tell me what I should remove.

@andir
Copy link
Member

andir commented Jan 14, 2018

Another GPD Pocket User 👍

Have a look at https://github.com/andir/nixos-gpd-pocket those are my configuration files for the gpd pocket. I am currently running nixos unstable on it since there are a few parts that have been patched in newer alsa, kernel, … versions. It also comes with the (almost always) latest version of the Kernel of Hans de Goede (RedHat employee that works on the hardware support for this and many other devices).

Things that do work for me with those settings:

  • booting it with a image created from the repo
  • X Server rotation (gnome does it's own thing os that is still broken, Has has submitted patches to gnome and they are in gnome master, will be released with next stable release IIRC)
  • WiFi works - I bundled that custom pci textfile that was required
  • Suspend/Resume works
  • Charging Support (via USB-C PD)
  • Backlight controls are working

I did intend to provide those changes to this repo as soon as everything is mainline/upstream. Feel free to pull those changes into your PR :-)

@lbonn
Copy link
Author

lbonn commented Jan 14, 2018

Thanks, that looks indeed more polished, I'll look into it.

This setup is also intended to be used on the unstable channel, with a stock 4.14 kernel. As a result some of the support is still missing. On the plus side, this could already be mergeable and updated later (on 4.15's release?)

But I also realized that I forgot to include the brcmfmac4356 firmware anyway so my PR won't work as is.

Definitely opened it too fast...

@andir
Copy link
Member

andir commented Jan 14, 2018

Yep, mailine support is what this repo should probably prefer.

Don't worry. That is why there is review :-) You can improve over time.

};

# wifi
nixpkgs.config.allowUnfree = true;
Copy link
Member

@lukateras lukateras Jan 14, 2018

Choose a reason for hiding this comment

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

It should be up to the end user whether to allow unfree packages or not, even when crucial to hardware functionality.

Moreover, it would make sense to only enable the firmware if user explicitly allows unfree packages, so that people that don't install unfree packages can still use the profile, even if without functioning Wi-Fi:

nixpkgs.firmware = with pkgs; lib.optionals config.nixpkgs.config.allowUnfree [
  brcmfmac4356-firmware
]

See:

hardware.facetimehd.enable = lib.mkDefault
(config.nixpkgs.config.allowUnfree or false);

# wifi
nixpkgs.config.allowUnfree = true;
hardware.firmware = with pkgs; [
brcmfmac4356-firmware
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't evaluate:

undefined variable brcmfmac4356-firmware at /home/travis/build/NixOS/nixos-hardware/gpd/gpd-pocket/default.nix:29:5


# power management
services.tlp = {
enable = true;
Copy link
Member

Choose a reason for hiding this comment

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

This is already defined in laptop profile:

services.tlp.enable = lib.mkDefault true;

'';
xrandrHeads = [ { output= "DSI1"; monitorConfig = "Option \"Rotate\" \"right\""; } ];
libinput = {
enable = true;
Copy link
Member

Choose a reason for hiding this comment

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

This is already defined in PC profile:

services.xserver.libinput.enable = lib.mkDefault true;

Copy link
Member

@lukateras lukateras left a comment

Choose a reason for hiding this comment

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

Also, gpd/gpd-pocket should be moved to gpd/pocket, following the current naming convention.

};

environment.variables = {
GDK_SCALE = "2"; # DPI
Copy link
Member

Choose a reason for hiding this comment

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

All non-mergable attributes should be set via lib.mkDefault so that they can be overrided in user profile:

GDK_SCALE = lib.mkDefault "2";

libinput = {
enable = true;
};
inputClassSections = [''
Copy link
Member

Choose a reason for hiding this comment

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

Is this required to discover input devices?

Option "TearFree" "true"
Option "DRI" "3"
'';
xrandrHeads = [ { output= "DSI1"; monitorConfig = "Option \"Rotate\" \"right\""; } ];
Copy link
Member

@lukateras lukateras Jan 14, 2018

Choose a reason for hiding this comment

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

Nitpick: "Option \"Rotate\" \"right\"" -> ''Option "Rotate" "right"''
Also, it would be easier to read with each attribute on a separate line.

services.xserver = {
dpi = 168;
deviceSection = ''
Option "AccelMethod" "sna"
Copy link
Member

Choose a reason for hiding this comment

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

Does explicit acceleration method affect anything?

};

# TODO: fix media keys
# sound.mediaKeys.enable = true;
Copy link
Member

Choose a reason for hiding this comment

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

sound.mediaKeys.enable overlaps with some desktop managers (e.g. Xfce), which is why it is not set in this repo even if the device does have media keys.

hardware.pulseaudio = {
enable = true;
extraConfig = ''
set-card-profile alsa_card.platform-cht-bsw-rt5645 HiFi
Copy link
Member

Choose a reason for hiding this comment

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

Is this required to make audio work?

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 some hacks required with current mainline kernels. This will change in the future (4.15+).
I am not sure if this is exactly the one since I've been running the 4.15-rc kernels on mine.

set-sink-port alsa_output.platform-cht-bsw-rt5645.HiFi__hw_chtrt5645_0__sink [Out] Speaker
'';
daemon.config = {
realtime-scheduling = "no";
Copy link
Member

Choose a reason for hiding this comment

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

Why is it disabled?

};

hardware.pulseaudio = {
enable = true;
Copy link
Member

@lukateras lukateras Jan 14, 2018

Choose a reason for hiding this comment

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

So far there are no profiles that explicitly depend on PulseAudio: the idea is to not force PulseAudio (there are cases that warrant pure ALSA setup, or Jack). Extra configuration for PulseAudio (to make it work once it's enabled) is of course welcome.

@lukateras
Copy link
Member

lukateras commented Jan 14, 2018

Also, would you license this work under CC0-1.0? License is not in the master branch yet, see #47.

@lbonn
Copy link
Author

lbonn commented Jan 15, 2018

Licensing it under CC0-1.0 is fine by me, if @andir also agrees for the part I'd eventually take from their repo.

I tried to apply some of your changes and I'll do some test later to verify that nothing is extraneous.

About the wifi firmware, I suppose it's not really the place to put some blobs (see https://github.com/andir/nixos-gpd-pocket/tree/master/firmware). Would there be an alternate solution, for example leaving some instructions for the user to add and include from another channel?

@andir
Copy link
Member

andir commented Jan 15, 2018

For what it is worth you could pull that from my repo.... I also grant permission to re-use my configuration from THAT repo under CC0-1.0.

@lukateras
Copy link
Member

I think blob here will do, but it could be merged with Nixpkgs for a wider reach, perhaps later.

@Mic92
Copy link
Member

Mic92 commented Mar 9, 2018

any news here?

@lbonn
Copy link
Author

lbonn commented Mar 12, 2018

@Mic92 I'm a bit short on time these days unfortunately, if someone wants to make progress on that, be my guest

@Ma27
Copy link
Member

Ma27 commented Mar 12, 2018

@lbonn wrong username? ;)

@lbonn
Copy link
Author

lbonn commented Mar 12, 2018

Oops, sorry

@grahamc
Copy link
Member

grahamc commented Mar 12, 2018 via email

@matthew-piziak
Copy link

The GPD Pocket 2 is out now. Anybody running NixOS on that machine yet?

@yrashk
Copy link

yrashk commented Apr 24, 2019

@matthew-piziak I should be getting my Pocket 2 soon, interested to try out!

@matthew-piziak
Copy link

@yrashk Exciting! Looking forward to hearing what you think. For what it's worth, I'm now using this configuration on a GDP 1 of my own. Works great!

@Mic92
Copy link
Member

Mic92 commented Jul 28, 2020

Looks like this PR got stalled. If someone wants to open a new PR, feel free.

@Mic92 Mic92 closed this Jul 28, 2020
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

Successfully merging this pull request may close these issues.

None yet

8 participants