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

phosh: init at 0.10.2 #121226

Merged
merged 6 commits into from May 1, 2021
Merged

phosh: init at 0.10.2 #121226

merged 6 commits into from May 1, 2021

Conversation

zhaofengli
Copy link
Member

Motivation for this change

Another attempt to bring Librem 5 packages to Nixpkgs, based on #88767. Tested on PinePhone running Mobile NixOS.

Pinging authors: @archseer @jtojnar @masipcat

It's running! iagno
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@r-rmcgibbo
Copy link

r-rmcgibbo commented Apr 30, 2021

Result of nixpkgs-review pr 121226 at adc39f01 run on aarch64-linux 1

2 packages built successfully:
  • phoc
  • phosh

Result of nixpkgs-review pr 121226 at adc39f01 run on x86_64-linux 1

2 packages built successfully:
  • phoc
  • phosh
7 suggestions:
  • warning: missing-patch-comment

    Please add a comment on the line above, explaining the purpose of this patch.
    Near pkgs/applications/misc/phoc/default.nix:27:7:

       |
    27 |       ./0001-Revert-layer-shell-error-on-0-dimension-without-anch.patch
       |       ^
    
  • warning: unused-argument

    Unused argument: squeekboard.
    Near pkgs/applications/window-managers/phosh/default.nix:25:3:

       |
    25 | , squeekboard
       |   ^
    
  • warning: unused-argument

    Unused argument: makeDesktopItem.
    Near pkgs/applications/window-managers/phosh/default.nix:31:3:

       |
    31 | , makeDesktopItem
       |   ^
    
  • warning: unused-argument

    Unused argument: dbus.
    Near pkgs/applications/misc/phoc/default.nix:14:3:

       |
    14 | , dbus
       |   ^
    
  • warning: unused-argument

    Unused argument: git.
    Near pkgs/applications/window-managers/phosh/default.nix:29:3:

       |
    29 | , git
       |   ^
    
  • warning: unused-argument

    Unused argument: cmake.
    Near pkgs/applications/misc/phoc/default.nix:15:3:

       |
    15 | , cmake
       |   ^
    
  • warning: missing-patch-comment

    Please add a comment on the line above, explaining the purpose of this patch.
    Near pkgs/applications/misc/phoc/default.nix:28:7:

       |
    28 |       ./0002-stop-including-eglmesaext-h.patch
       |       ^
    

@zhaofengli zhaofengli changed the title Librem 5 phone packages (Take 2) phosh: init at 0.10.2 Apr 30, 2021
@zhaofengli
Copy link
Member Author

Changed title as Phosh is the only thing left from the original PR 😆

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Co-authored-by: Jordi Masip <jordi@masip.cat>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Co-authored-by: Jordi Masip <jordi@masip.cat>
@jtojnar
Copy link
Contributor

jtojnar commented Apr 30, 2021

Re display manager integration, see services.xserver.displayManager.sessionPackages option.

@jtojnar
Copy link
Contributor

jtojnar commented Apr 30, 2021

With phosh in services.xserver.displayManager.sessionPackages, I can log in to phosh through GDM. So we should probably add that plus services.xserver.desktopManager.gnome3.enable = true; and probably create a NixOS module for feedbackd and enable that here as I am getting ton of errors like:

Apr 30 07:25:10 nixos .phosh-wrapped[1231]: Failed to trigger feedback for 'window-close': GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.sigxcpu.Feedback was not provided by any .service files

@jtojnar
Copy link
Contributor

jtojnar commented Apr 30, 2021

Also the option should probably be services.xserver.desktopManager.phosh.enable.

@jtojnar
Copy link
Contributor

jtojnar commented Apr 30, 2021

Also do we need some other patches? Because most apps do not seem to fit on the screen – even Epiphany, which is supposed to be Phosh optimized (or is that only part of GNOME 40?)

@Mohammer5
Copy link

Huge shout-out to you guys! Thanks for keeping working on this ❤️

@zhaofengli
Copy link
Member Author

Just made some changes to the module to make it possible to configure the compositor. I think programs.phosh is better than services.xserver.desktopManager.phosh as it may be common to be started directly without a display manager, in line with programs.sway.

@dotlambda
Copy link
Member

dotlambda commented Apr 30, 2021

Besides Ephiphany, Firefox is snappier but you need postmarketOS's userChrome.css for it to be actually usable.

We should package that for NixOS. Maybe we can package policies.json etc. and merge them with the firefox package using symlinkJoin?
EDIT: We can use https://github.com/NixOS/nixpkgs/blob/master/doc/builders/packages/firefox.section.md#build-wrapped-firefox-with-extensions-and-policies but have to translate the policies to Nix.

@zhaofengli
Copy link
Member Author

@dotlambda

Besides Ephiphany, Firefox is snappier but you need postmarketOS's userChrome.css for it to be actually usable.

We should package that for NixOS. Maybe we can package policies.json etc. and merge them with the firefox package using symlinkJoin?
EDIT: We can use https://github.com/NixOS/nixpkgs/blob/master/doc/builders/packages/firefox.section.md#build-wrapped-firefox-with-extensions-and-policies but have to translate the policies to Nix.

Sure, I took a stab and made #121356.

@jtojnar
Copy link
Contributor

jtojnar commented May 1, 2021

It fails to start for me without full GNOME enabled:

phosh.nix

Built using env NIX_PATH=nixpkgs=$HOME/Projects/nixpkgs:nixos-config=../nix-playground/phosh.nix nix-shell -p '(nixos {}).nixos-rebuild' --run 'nixos-rebuild build-vm'

Ran using env QEMU_NET_OPTS="hostfwd=tcp::2222-:22,hostfwd=tcp::7777-:80," ./result/bin/run-*-vm

{ pkgs, config, ... }: {
  environment.systemPackages = with pkgs; [
    gdb
    dfeet
    bustle
    htop
    gnome3.dconf-editor
    calls
  ];

  services.xserver = {
    enable = true;
    layout = "cz";
    xkbVariant = "qwerty";

    displayManager.gdm.enable = true;
    displayManager.gdm.debug = true;
    # desktopManager.gnome3.enable = true; # fais without this
  };
  environment.sessionVariables.GNOME_SESSION_DEBUG = "1";

  programs.phosh.enable = true;

  services.openssh.enable = true;

  users.extraUsers.jtojnar = {
    isNormalUser = true;
    uid = 1000;
    extraGroups = [ "wheel" "networkmanager" ];
    password = "";
    openssh.authorizedKeys.keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYbOlZydfRRCGCT08wdtPcpfSrgxMc6weDx3NcWrnMpVgxnMs3HozzkaS/hbcZUocn7XbCOyaxEd1O8Fuaw4JXpUBcMetpPXkQC+bZHQ3YsZZyzVgCXFPRF88QQj0nR7YVE1AeAifjk3TCODstTxit868V1639/TVIi5y5fC0/VbYG2Lt4AadNH67bRv8YiO3iTsHQoZPKD1nxA7yANHCuw38bGTHRhsxeVD+72ThbsYSZeA9dBrzACpEdnwyXclaoyIOnKdN224tu4+4ytgH/vH/uoUfL8SmzzIDvwZ4Ba2yHhZHs5iwsVjTvLe7jjE6I1u8qY7X8ofnanfNcsmz/ jtojnar@kaiser"];
  };

  environment.enableDebugInfo = true;

  virtualisation.qemu.options = [ "-device intel-hda -device hda-duplex" ];
  virtualisation.memorySize = 2048;
  virtualisation.diskSize = 8048;
}

Screenshot from 2021-05-01 06-02-16

May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1133]: pci id for fd 9: 1234:1111, driver (null)
May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1133]: MESA-LOADER: failed to open bochs-drm: /run/opengl-driver/lib/dri/bochs-drm_dri.so: cannot open shared object file: No such file or directory (search paths /run/opengl-driver/lib/dri)
May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1133]: failed to load driver: bochs-drm
May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1133]: Running compositor on wayland display 'wayland-0'
May 01 03:03:48 nixos gdm-password][1100]: accountsservice: ActUserManager: sending user-changed signal for user jtojnar
May 01 03:03:48 nixos gdm-password][1100]: accountsservice: ActUserManager: sent user-changed signal for user jtojnar
May 01 03:03:48 nixos gdm-password][1100]: accountsservice: ActUserManager: updating user jtojnar
May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1156]: No schemas installed
May 01 03:03:48 nixos gdm-launch-environment][801]: accountsservice: ActUserManager: sending user-changed signal for user gdm
May 01 03:03:48 nixos gdm-launch-environment][801]: accountsservice: ActUserManager: sent user-changed signal for user gdm
May 01 03:03:48 nixos gdm-launch-environment][801]: accountsservice: ActUserManager: updating user gdm
May 01 03:03:48 nixos gdm-password][1100]: accountsservice: ActUserManager: sending user-changed signal for user jtojnar
May 01 03:03:48 nixos gdm-password][1100]: accountsservice: ActUserManager: sent user-changed signal for user jtojnar
May 01 03:03:48 nixos gdm-password][1100]: accountsservice: ActUserManager: updating user jtojnar
May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1141]: gnome-session-binary[1141]: DEBUG(+): Enabling debugging
May 01 03:03:48 nixos gnome-session-binary[1141]: DEBUG(+): Enabling debugging
May 01 03:03:48 nixos /nix/store/cy6sspkl83ip4w3n29y2bvjqqxap2zng-gdm-3.38.2.1/libexec/gdm-wayland-session[1141]: gnome-session-binary[1141]: DEBUG(+): hardware acceleration check is disabled
May 01 03:03:48 nixos gnome-session-binary[1141]: DEBUG(+): hardware acceleration check is disabled

Since the bochs-drm error is there too with full GNOME, I suspect some schemas are missing somewhere.

@zhaofengli
Copy link
Member Author

zhaofengli commented May 1, 2021

@jtojnar

Since the bochs-drm error is there too with full GNOME, I suspect some schemas are missing somewhere.

Try adding --debug to the gnome-session command. That should give you more info as to what went wrong.

Edit: This is my Phosh service, adapted from the upstream .service file:

{
  systemd.services.phosh = {
    wantedBy = [ "graphical.target" ];
    serviceConfig = {
      ExecStart = "${pkgs.phosh}/bin/phosh";
      User = 1000;
      PAMName = "login";
      WorkingDirectory = "~";

      TTYPath = "/dev/tty7";
      TTYReset = "yes";
      TTYVHangup = "yes";
      TTYVTDisallocate = "yes";

      StandardInput = "tty-fail";
      StandardOutput = "journal";
      StandardError = "journal";

      UtmpIdentifier = "tty7";
      UtmpMode = "user";

      Restart = "always";
    };
  };
}

@samueldr
Copy link
Member

samueldr commented May 1, 2021

Sorry if irrelevant, haven't tried any of these changes here, but with IIRC sway, I don't recall for Plasma Mobile, I had to have the following config snippet:

      boot.initrd.kernelModules = [
        # Work around issue where some compositors would fail to take the GPU
        # with "operation not permitted"
        "bochs_drm"
      ];

@jtojnar
Copy link
Contributor

jtojnar commented May 1, 2021

@zhaofengli It seems to start when I also add

services.gnome3.core-os-services.enable = true;

@zhaofengli
Copy link
Member Author

@jtojnar

@zhaofengli It seems to start when I also add

services.gnome3.core-os-services.enable = true;

Hmm, good catch. I don't have it enabled, but I have programs.dconf.enable and disabling it plus deleting the configurations in ~/.config and ~/.local/share was enough for me to reproduce the crash. Let's play safe so I've added core-os-services to the module.

@ofborg ofborg bot requested a review from jtojnar May 1, 2021 05:27
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "libgnome-volume-control";
rev = "ae1a34aafce7026b8c0f65a43c9192d756fe1057";
Copy link
Contributor

Choose a reason for hiding this comment

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

We might want to update this like the other GNOME components https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/843

Though upstream still uses this version so it might be okay: https://source.puri.sm/Librem5/phosh/-/tree/master/subprojects

@zhaofengli
Copy link
Member Author

Also for feedbackd, should I add the changes to this PR as well? It's a couple lines of changes to the package plus a simple NixOS module.

@jtojnar
Copy link
Contributor

jtojnar commented May 1, 2021

If you don’t mind, please.

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
Co-authored-by: Jordi Masip <jordi@masip.cat>
@zhaofengli
Copy link
Member Author

Ok, added. Also removed the redundant security.pam.services.gdm.enableGnomeKeyring as it's in services.gnome3.core-os-services.

@ofborg ofborg bot requested review from Pacman99 and jtojnar May 1, 2021 07:04
Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

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

Works great, thanks for pushing this to the finish line.

@Mindavi
Copy link
Contributor

Mindavi commented May 1, 2021

I tried running the example jtojnar posted. Looks good in general, but had some weird screen artifacts. It also seemed like the on-screen keyboard had some issues with starting.

Copy link
Contributor

@Pacman99 Pacman99 left a comment

Choose a reason for hiding this comment

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

Looks great!

@jtojnar jtojnar merged commit 1733bad into NixOS:master May 1, 2021
@zhaofengli
Copy link
Member Author

I tried running the example jtojnar posted. Looks good in general, but had some weird screen artifacts. It also seemed like the on-screen keyboard had some issues with starting.

Can't say anything about the screen artifacts, but the on-screen keyboard doesn't start if Phosh is in the Docked mode which you can toggle in the top menu.

@mweinelt
Copy link
Member

Heads up anyone who is testing this! An issue related to PIN verification was reported in #123435. Please be safe, if you are actually using phosh already!

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

Successfully merging this pull request may close these issues.

None yet