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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/phosh-demo: init #352

Closed
wants to merge 1 commit into from
Closed

Conversation

zhaofengli
Copy link
Member

A very simple Phosh demo image with the full default GNOME app set, with gnome-terminal replaced by kgx. Not very exciting as many apps are broken on mobile 馃槙

Librem has a GTK patchset which you can apply with my overlay (not included).

Screenshot PinePhone running Mobile NixOS with Phosh

Comment on lines 38 to 78
systemd.defaultUnit = "graphical.target";
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";
};
};

services.xserver.desktopManager.gnome3.enable = true;

# Unpatched gnome-initial-setup is partially broken in small screens
services.gnome3.gnome-initial-setup.enable = false;

programs.phosh.enable = true;
environment.systemPackages = [ terminal ];
environment.gnome3.excludePackages = with pkgs.gnome3; [
gnome-terminal
];

environment.etc."machine-info".text = lib.mkDefault ''
CHASSIS="handset"
'';
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't most of this be part of a configuration option in upstream NixOS?

Relatedly, maybe, can this be done through a display manager?

Copy link
Member

@samueldr samueldr May 17, 2021

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

hostnamectl reads /etc/machine-info, but only if it cannot find the chassis type via another method such as SMBIOS (?) or the device tree.

Fortunately, https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux.git/commit/?h=sunxi/for-next&id=d900a1cd310de097fb94796ca575c118b2637b3b adds the chassis type for Pinephones. We just have to wait until the sunxi maintainers merge that into mainline.

Copy link
Member

Choose a reason for hiding this comment

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

Or we can fetchpatch it / add it as needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't most of this be part of a configuration option in upstream NixOS?

See NixOS/nixpkgs#153940 for a PR to add the Phosh systemd service.

@Mindavi
Copy link
Contributor

Mindavi commented May 2, 2021

I did try to add this to a config to get phosh running, but everything seems crashy. Not sure what I'm doing though... (phoc already crashes with some vague errors, and I really don't understand desktop managers well enough).

Have not tried this as-is though, maybe that works better.

@zhaofengli zhaofengli marked this pull request as draft May 11, 2021 16:52
users.users.${defaultUserName} = {
isNormalUser = true;
# Numeric pin makes it **possible** to input on the lockscreen.
password = "1234";
Copy link
Contributor

Choose a reason for hiding this comment

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

How about users.users.<name>.hashedPassword instead?

Copy link
Member

Choose a reason for hiding this comment

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

It's not meant for actual use. This is meant more of an example configuration you can look at as a starting point.

Including this in your system configuration is foolish :).

We probably should make this more obvious in some way.

Copy link

Choose a reason for hiding this comment

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

Had some clashes with user names and identifiers while upgrading profile from the xfce demo. Had to change user name to "nixos" and id to 1001 (in several places) to make it start.

@genofire
Copy link

i got an error:

error: The option `security.polkit.enable' has conflicting definition values:
- In `/nix/store/9wwj3h66flmwfs0iq0rc88473xgfnag1-source/nixos/modules/services/x11/desktop-managers/gnome.nix': true
- In `/home/genofire/src/github.com/NixOS/mobile-nixos/modules/cross-workarounds.nix': false
(use '--show-trace' to show detailed location information)

@puffnfresh
Copy link
Contributor

puffnfresh commented Oct 30, 2021

@genofire you can't cross-compile this, you have to use the same system (e.g. use aarch64 to compile for aarch64)

You try using QEMU via the binfmt wrapper:

https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_QEMU

And then hack up the config to override the system:

nixpkgs.localSystem = { system = "aarch64-linux"; };

This works for me to compile the original demo.

@mhuesch
Copy link

mhuesch commented Nov 15, 2021

in case anyone needs a bit of help adapting this into an example config (I did), I have a demo repo which builds for pinephone: https://github.com/mhuesch/pinephone-mobile-nixos-flake-example

all credit for actual implementation due to @zhaofengli & the mobile-nixos contributors 馃檪 馃檱

@genofire
Copy link

genofire commented Jan 15, 2022

It works on my pinephone, good work.
But the virtuelle keyboard is "hidden" behind Accessibility settings,
also default Apps (Call, Chatty) ...

on first look i miss also feedbackd (but maybe i overseen it)

@grwlf
Copy link

grwlf commented Jan 26, 2022

I tested it briefly, and it works. I think, this PR will lower the MobileNixos entry level significantly, from "space-high" to somewhere like "a hard quest" ;)

The one significant issue is the on-screen keyboard. I can't see it at all, had to plug the desktop keyboard in. Will try to figure out what is wrong with it.

@zhaofengli
Copy link
Member Author

I tested it briefly, and it works. I think, this PR will lower the MobileNixos entry level significantly, from "space-high" to somewhere like "a hard quest" ;)

Yeah, I should rebase and get this merged soon.

The one significant issue is the on-screen keyboard. I can't see it at all, had to plug the desktop keyboard in. Will try to figure out what is wrong with it.

For the on-screen keyboard, you may need to toggle the docked mode in the quick settings.

@zhaofengli zhaofengli marked this pull request as ready for review January 28, 2022 09:16
@grwlf
Copy link

grwlf commented Jan 28, 2022

New version of PR doesn't build for me because of a missing url

building '/nix/store/ymaxrlrn870wrcb20j28mi735qgc6gvs-pp-keyboard.patch.drv'...
trying https://github.com/dreemurrs-embedded/Pine64-Arch/raw/master/PKGBUILDS/pine64/linux-megi/pp-keyboard.patch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
error: cannot download pp-keyboard.patch from any mirror

@zhaofengli
Copy link
Member Author

New version of PR doesn't build for me because of a missing url

Oops, accidentally added a stray commit. Fixed.

@davidak
Copy link
Member

davidak commented Jan 29, 2022

@zhaofengli you can drop a commit when rebasing. https://stackoverflow.com/a/37311746/2611995

@zhaofengli
Copy link
Member Author

@zhaofengli you can drop a commit when rebasing. https://stackoverflow.com/a/37311746/2611995

Yes, I know and have dropped it. I had an extra commit on master (an old version of #452) and didn't notice when rebasing interactively.

@zhaofengli
Copy link
Member Author

With NixOS/nixpkgs#153940 finally merged, it makes sense for that to be used instead of manually defining a service. Let's merge #468 instead.

@zhaofengli zhaofengli closed this May 7, 2022
@zhaofengli zhaofengli deleted the phosh-demo branch May 7, 2022 20:28
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

9 participants