PinePhone: Difference between revisions

From NixOS Wiki
imported>Tom
→‎Sensors: Note firmware re sensors
Klinger (talk | contribs)
mNo edit summary
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[https://en.wikipedia.org/wiki/PinePhone PinePhone] is supported by [https://mobile.nixos.org/ Mobile NixOS]: https://mobile.nixos.org/devices/pine64-pinephone.html
[https://en.wikipedia.org/wiki/PinePhone PinePhone] is supported by [https://mobile.nixos.org/ Mobile NixOS]: https://mobile.nixos.org/devices/pine64-pinephone.html


This guide is discusses how to use [https://puri.sm/posts/phosh-overview/ Phosh], the GNOME-derived UI used by Librem and Mobian.
This guide is discusses how to use [https://phosh.mobi/ Phosh], the GNOME-derived UI used by Librem and Mobian.


== Requirements ==
== Requirements ==
Line 9: Line 9:
* [https://github.com/NixOS/mobile-nixos/issues/342 boot.growPartition has no effect]
* [https://github.com/NixOS/mobile-nixos/issues/342 boot.growPartition has no effect]
* [https://github.com/NixOS/mobile-nixos/issues/373 how to cross-compile]
* [https://github.com/NixOS/mobile-nixos/issues/373 how to cross-compile]
* [https://github.com/NixOS/mobile-nixos/issues/372 build.disk-image via binfmt taking 40mins doing a find/du on my /nix/store]
* [https://github.com/NixOS/nixpkgs/issues/131159 GTK application startup is slowed by lots of icon I/O]


== Status ==
== Status ==


=== Phosh ===
=== Phosh ===
https://github.com/NixOS/mobile-nixos/pull/352 is a PR to add a phosh-demo to mobile-nixos. The author of this wiki page uses this PR.
Working with:
 
<syntaxhighlight lang="nix">
xserver.desktopManager.phosh = {
  enable = true;
  user = "alice";
  group = "users";
  # for better compatibility with x11 applications
  phocConfig.xwayland = "immediate";
};
</syntaxhighlight>
 
=== Battery ===
Wake-on-modem works.
Wake-on-WiFi is not supported. Something like https://gist.github.com/Peetz0r/bf8fd93a60962b4afcf2daeb4305da40 is needed.


=== Browsing ===
=== Browsing ===
Line 28: Line 40:


Working with:
Working with:
* [https://github.com/NixOS/mobile-nixos/pull/380 Use the more generic device path for modem]
* the following:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [ pkgs.calls ];
programs.calls.enable = true;
services.dbus.packages = [ pkgs.callaudiod ];
# Optional but recommended. https://github.com/NixOS/nixpkgs/pull/162894
systemd.services.ModemManager.serviceConfig.ExecStart = [
  "" # clear ExecStart from upstream unit file.
  "${pkgs.modemmanager}/sbin/ModemManager --test-quick-suspend-resume"
];
</syntaxhighlight>
</syntaxhighlight>


Known issues:
Known issues:
* incoming calls don't trigger music to be paused. Likely need something like https://source.puri.sm/Librem5/librem5-base/-/merge_requests/170/diffs
* incoming calls don't trigger music to be paused. Likely need something like https://source.puri.sm/Librem5/librem5-base/-/merge_requests/170/diffs
* when the screen is locked, incoming calls can only be answered after unlocking.


=== SMS ===
=== SMS ===
Working with:
Working with:
* {{pull|122373|Chatty}}
* and the following:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
environment.systemPackages = [
environment.systemPackages = [ pkgs.chatty ];
  (pkgs.chatty.override {
    plugins = [
      pkgs.purple-mm-sms
    ];
  })
];
</syntaxhighlight>
</syntaxhighlight>


Line 59: Line 63:


=== Camera ===
=== Camera ===
{{ic|pkgs.megapixels}} is the only known application to [https://git.sr.ht/~martijnbraam/megapixels#linux-video-subsystem work with V4L2]. Does not always start correctly, retrying might help.
{{ic|pkgs.megapixels}} is the only known application to [https://git.sr.ht/~martijnbraam/megapixels#linux-video-subsystem work with Pinephone]. Does not always start correctly, retrying might help.


* Front camera works out-of-the-box .
* Front camera works out-of-the-box.
* Back camera works with this having been flashed to the boot partition: https://github.com/NixOS/mobile-nixos/pull/392
* Back camera works, but autofocus does not ( https://github.com/NixOS/mobile-nixos/issues/393 )


=== Mobile internet ===
=== Mobile internet ===
Working (imperative), with:
Working via gnome-control-center ("Mobile Broadband" section), or:


{{Commands|$ nmcli c add type gsm ifname cdc-wdm0 con-name $PROVIDER apn $APN}}
{{Commands|$ nmcli c add type gsm ifname cdc-wdm0 con-name $PROVIDER apn $APN}}
Other distributions use [https://source.puri.sm/Librem5/gnome-control-center Librem's fork of gnome-control-center] which has a mobile internet panel. https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/583 tracks the upstreaming of this functionality.


=== GPS ===
=== GPS ===
Line 91: Line 93:
=== Disk encryption ===
=== Disk encryption ===
The boot process supports opening LUKS volumes. Creating an image to use LUKS is unsupported, but possible. The idea is to write an encrypted LUKS volume to the root partition, as described in  https://github.com/NixOS/mobile-nixos/tree/master/examples/testing/qemu-cryptsetup.
The boot process supports opening LUKS volumes. Creating an image to use LUKS is unsupported, but possible. The idea is to write an encrypted LUKS volume to the root partition, as described in  https://github.com/NixOS/mobile-nixos/tree/master/examples/testing/qemu-cryptsetup.
=== Hardware acceleration for video ===
See https://github.com/NixOS/mobile-nixos/issues/398.


=== Torch ===
=== Torch ===
See https://github.com/NixOS/mobile-nixos/issues/379
Working, per https://github.com/NixOS/mobile-nixos/issues/379


=== Bluetooth ===
=== Bluetooth ===
Not working in Phosh settings. Works on Pinephones according to https://xnux.eu/devices/pine64-pinephone.html
Working with:
 
<syntaxhighlight lang="nix">
mobile.boot.stage-1.firmware = [
  config.mobile.device.firmware
];
</syntaxhighlight>


I think we need to make the bluetooth kernel driver a module, so that the firmware has a chance to load.
=== Modem firmware ===
Per https://wiki.pine64.org/wiki/PineModems#Upgrade/switch_firmware_via_fwupd , fwupd can be used to flash the FOSS Modem firmware. To enable fwupd:
 
<syntaxhighlight lang="nix">
services.fwupd.enable = true;
</syntaxhighlight>


=== Alarm clocks ===
=== Alarm clocks ===
Line 107: Line 123:
== Recommended applications ==
== Recommended applications ==


See https://linmobapps.frama.io/ for a list of applications that behave well on small screens, including:
See https://linmobapps.frama.io/ for a list of applications that behave well on small screens, and in particular https://apps.gnome.org/.
 
* {{ic|pkgs.gnome.gnome-chess}}
* {{ic|pkgs.gnome.gnome-podcasts}}
* {{ic|pkgs.portfolio-filemanager}}
* {{ic|pkgs.numberstation}} - TOTP


== See also ==
== See also ==
Line 122: Line 133:
* [https://wiki.postmarketos.org/wiki/PINE64_PinePhone_(pine64-pinephone) PostmarketOS's Pinephone docs]
* [https://wiki.postmarketos.org/wiki/PINE64_PinePhone_(pine64-pinephone) PostmarketOS's Pinephone docs]
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone PostmarketOS's Pinephone config]
* [https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone PostmarketOS's Pinephone config]
[[Category: Hardware]]

Latest revision as of 19:40, 24 April 2024

PinePhone is supported by Mobile NixOS: https://mobile.nixos.org/devices/pine64-pinephone.html

This guide is discusses how to use Phosh, the GNOME-derived UI used by Librem and Mobian.

Requirements

This document assumes you have set up NixOS on your PinePhone, as described in https://mobile.nixos.org/getting-started.html

Beware known issues:

Status

Phosh

Working with:

xserver.desktopManager.phosh = {
  enable = true;
  user = "alice";
  group = "users";
  # for better compatibility with x11 applications
  phocConfig.xwayland = "immediate";
};

Battery

Wake-on-modem works. Wake-on-WiFi is not supported. Something like https://gist.github.com/Peetz0r/bf8fd93a60962b4afcf2daeb4305da40 is needed.

Browsing

Sound

Working. Settings -> Sound ->Output -> Configuration -> HiFi

Calling

Working with:

programs.calls.enable = true;
# Optional but recommended. https://github.com/NixOS/nixpkgs/pull/162894
systemd.services.ModemManager.serviceConfig.ExecStart = [
  "" # clear ExecStart from upstream unit file.
  "${pkgs.modemmanager}/sbin/ModemManager --test-quick-suspend-resume"
];

Known issues:

SMS

Working with:

environment.systemPackages = [ pkgs.chatty ];

MMS

Unsupported. See https://source.puri.sm/Librem5/chatty/-/issues/30

Camera

pkgs.megapixels is the only known application to work with Pinephone. Does not always start correctly, retrying might help.

Mobile internet

Working via gnome-control-center ("Mobile Broadband" section), or:

$ nmcli c add type gsm ifname cdc-wdm0 con-name $PROVIDER apn $APN

GPS

Working with GNOME applications with:

services.geoclue2.enable = true;
users.users.geoclue.extraGroups = [ "networkmanager" ];

Sensors

The acceleration, compass, and ambient light sensors provide working auto-rotation, compass, and auto-brightness, when you:

hardware.sensor.iio.enable = true;
hardware.firmware = [ config.mobile.device.firmware ];

Disk encryption

The boot process supports opening LUKS volumes. Creating an image to use LUKS is unsupported, but possible. The idea is to write an encrypted LUKS volume to the root partition, as described in https://github.com/NixOS/mobile-nixos/tree/master/examples/testing/qemu-cryptsetup.

Hardware acceleration for video

See https://github.com/NixOS/mobile-nixos/issues/398.

Torch

Working, per https://github.com/NixOS/mobile-nixos/issues/379

Bluetooth

Working with:

mobile.boot.stage-1.firmware = [
  config.mobile.device.firmware
];

Modem firmware

Per https://wiki.pine64.org/wiki/PineModems#Upgrade/switch_firmware_via_fwupd , fwupd can be used to flash the FOSS Modem firmware. To enable fwupd:

services.fwupd.enable = true;

Alarm clocks

Not working:

Recommended applications

See https://linmobapps.frama.io/ for a list of applications that behave well on small screens, and in particular https://apps.gnome.org/.

See also