Merge pull request #153940 from tomfitzhenry/phosh-service

nixos/phosh: add Phosh, the Phone Shell
main
Rick van Schijndel 2 years ago committed by GitHub
commit 17c252aab1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      nixos/modules/module-list.nix
  2. 2
      nixos/modules/services/x11/desktop-managers/default.nix
  3. 73
      nixos/modules/services/x11/desktop-managers/phosh.nix

@ -196,7 +196,6 @@
./programs/partition-manager.nix ./programs/partition-manager.nix
./programs/plotinus.nix ./programs/plotinus.nix
./programs/proxychains.nix ./programs/proxychains.nix
./programs/phosh.nix
./programs/qt5ct.nix ./programs/qt5ct.nix
./programs/screen.nix ./programs/screen.nix
./programs/sedutil.nix ./programs/sedutil.nix

@ -18,7 +18,7 @@ in
# determines the default: later modules (if enabled) are preferred. # determines the default: later modules (if enabled) are preferred.
# E.g., if Plasma 5 is enabled, it supersedes xterm. # E.g., if Plasma 5 is enabled, it supersedes xterm.
imports = [ imports = [
./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix ./none.nix ./xterm.nix ./phosh.nix ./xfce.nix ./plasma5.nix ./lumina.nix
./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix ./lxqt.nix ./enlightenment.nix ./gnome.nix ./retroarch.nix ./kodi.nix
./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix ./mate.nix ./pantheon.nix ./surf-display.nix ./cde.nix
./cinnamon.nix ./cinnamon.nix

@ -3,7 +3,7 @@
with lib; with lib;
let let
cfg = config.programs.phosh; cfg = config.services.xserver.desktopManager.phosh;
# Based on https://source.puri.sm/Librem5/librem5-base/-/blob/4596c1056dd75ac7f043aede07887990fd46f572/default/sm.puri.OSK0.desktop # Based on https://source.puri.sm/Librem5/librem5-base/-/blob/4596c1056dd75ac7f043aede07887990fd46f572/default/sm.puri.OSK0.desktop
oskItem = pkgs.makeDesktopItem { oskItem = pkgs.makeDesktopItem {
@ -118,12 +118,39 @@ let
[cursor] [cursor]
theme = ${phoc.cursorTheme} theme = ${phoc.cursorTheme}
''; '';
in { in
{
options = { options = {
programs.phosh = { services.xserver.desktopManager.phosh = {
enable = mkEnableOption '' enable = mkOption {
Whether to enable, Phosh, related packages and default configurations. type = types.bool;
''; default = false;
description = "Enable the Phone Shell.";
};
package = mkOption {
type = types.package;
default = pkgs.phosh;
defaultText = literalExpression "pkgs.phosh";
example = literalExpression "pkgs.phosh";
description = ''
Package that should be used for Phosh.
'';
};
user = mkOption {
description = "The user to run the Phosh service.";
type = types.str;
example = "alice";
};
group = mkOption {
description = "The group to run the Phosh service.";
type = types.str;
example = "users";
};
phocConfig = mkOption { phocConfig = mkOption {
description = '' description = ''
Configurations for the Phoc compositor. Configurations for the Phoc compositor.
@ -135,14 +162,42 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.defaultUnit = "graphical.target";
# Inspired by https://gitlab.gnome.org/World/Phosh/phosh/-/blob/main/data/phosh.service
systemd.services.phosh = {
wantedBy = [ "graphical.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/bin/phosh";
User = cfg.user;
Group = cfg.group;
PAMName = "login";
WorkingDirectory = "~";
Restart = "always";
TTYPath = "/dev/tty7";
TTYReset = "yes";
TTYVHangup = "yes";
TTYVTDisallocate = "yes";
# Fail to start if not controlling the tty.
StandardInput = "tty-fail";
StandardOutput = "journal";
StandardError = "journal";
# Log this user with utmp, letting it show up with commands 'w' and 'who'.
UtmpIdentifier = "tty7";
UtmpMode = "user";
};
};
environment.systemPackages = [ environment.systemPackages = [
pkgs.phoc pkgs.phoc
pkgs.phosh cfg.package
pkgs.squeekboard pkgs.squeekboard
oskItem oskItem
]; ];
systemd.packages = [ pkgs.phosh ]; systemd.packages = [ cfg.package ];
programs.feedbackd.enable = true; programs.feedbackd.enable = true;
@ -152,7 +207,7 @@ in {
services.gnome.core-shell.enable = true; services.gnome.core-shell.enable = true;
services.gnome.core-os-services.enable = true; services.gnome.core-os-services.enable = true;
services.xserver.displayManager.sessionPackages = [ pkgs.phosh ]; services.xserver.displayManager.sessionPackages = [ cfg.package ];
environment.etc."phosh/phoc.ini".source = environment.etc."phosh/phoc.ini".source =
if builtins.isPath cfg.phocConfig then cfg.phocConfig if builtins.isPath cfg.phocConfig then cfg.phocConfig
Loading…
Cancel
Save