2022-08-05 22:47:53 +00:00
|
|
|
{ lib, config, pkgs, ... }:
|
2022-06-07 00:39:40 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
2022-08-01 07:23:49 +00:00
|
|
|
cfg = config.sane.gui.phosh;
|
2022-06-07 00:39:40 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
2022-08-01 07:23:49 +00:00
|
|
|
sane.gui.phosh.enable = mkOption {
|
2022-06-07 00:39:40 +00:00
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
};
|
2022-10-19 12:18:13 +00:00
|
|
|
sane.gui.phosh.useGreeter = mkOption {
|
|
|
|
description = ''
|
|
|
|
launch phosh via a greeter (like lightdm-mobile-greeter).
|
|
|
|
phosh is usable without a greeter, but skipping the greeter means no PAM session.
|
|
|
|
'';
|
2022-10-20 12:03:30 +00:00
|
|
|
default = true;
|
2022-10-19 12:18:13 +00:00
|
|
|
type = types.bool;
|
|
|
|
};
|
2022-06-07 00:39:40 +00:00
|
|
|
};
|
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
config = mkIf cfg.enable (mkMerge [
|
|
|
|
{
|
|
|
|
sane.gui.enable = true;
|
2022-08-02 23:00:37 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
users.users.avahi.uid = config.sane.allocations.avahi-uid;
|
|
|
|
users.users.colord.uid = config.sane.allocations.colord-uid;
|
|
|
|
users.users.geoclue.uid = config.sane.allocations.geoclue-uid;
|
|
|
|
users.users.rtkit.uid = config.sane.allocations.rtkit-uid;
|
|
|
|
users.groups.avahi.gid = config.sane.allocations.avahi-gid;
|
|
|
|
users.groups.colord.gid = config.sane.allocations.colord-gid;
|
2022-10-21 01:39:39 +00:00
|
|
|
users.groups.feedbackd.gid = config.sane.allocations.feedbackd-gid;
|
2022-10-19 12:18:13 +00:00
|
|
|
users.groups.geoclue.gid = config.sane.allocations.geoclue-gid;
|
|
|
|
users.groups.rtkit.gid = config.sane.allocations.rtkit-gid;
|
2022-08-02 23:00:37 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
# docs: https://github.com/NixOS/nixpkgs/blob/nixos-22.05/nixos/modules/services/x11/desktop-managers/phosh.nix
|
|
|
|
services.xserver.desktopManager.phosh = {
|
|
|
|
enable = true;
|
|
|
|
user = "colin";
|
|
|
|
group = "users";
|
|
|
|
phocConfig = {
|
|
|
|
# xwayland = "true";
|
|
|
|
# find default outputs by catting /etc/phosh/phoc.ini
|
|
|
|
outputs.DSI-1 = {
|
|
|
|
scale = 1.5;
|
|
|
|
};
|
2022-06-07 00:39:40 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
# XXX: phosh enables networkmanager by default; can probably disable these lines
|
|
|
|
networking.useDHCP = false;
|
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
networking.wireless.enable = lib.mkForce false;
|
2022-08-03 23:23:36 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
# XXX: not clear if these are actually needed?
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
services.blueman.enable = true;
|
2022-08-05 22:47:53 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
hardware.opengl.enable = true;
|
|
|
|
hardware.opengl.driSupport = true;
|
2022-06-07 01:10:19 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
environment.variables = {
|
|
|
|
# Qt apps won't always start unless this env var is set
|
|
|
|
QT_QPA_PLATFORM = "wayland";
|
|
|
|
# electron apps (e.g. Element) should use the wayland backend
|
|
|
|
# toggle this to have electron apps (e.g. Element) use the wayland backend.
|
|
|
|
# phocConfig.xwayland should be disabled if you do this
|
|
|
|
NIXOS_OZONE_WL = "1";
|
|
|
|
};
|
2022-08-05 22:47:53 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
sane.home-manager.extraPackages = with pkgs; [
|
|
|
|
phosh-mobile-settings
|
2022-10-01 00:19:08 +00:00
|
|
|
|
2022-10-19 12:18:13 +00:00
|
|
|
# TODO: see about removing this if the in-built gnome-settings bluetooth manager can work
|
|
|
|
gnome.gnome-bluetooth
|
|
|
|
];
|
|
|
|
}
|
|
|
|
(mkIf cfg.useGreeter {
|
2022-10-19 15:12:56 +00:00
|
|
|
services.xserver.enable = true;
|
2022-10-21 04:16:38 +00:00
|
|
|
# NB: setting defaultSession has the critical side-effect that it lets org.freedesktop.AccountsService
|
|
|
|
# know that our user exists. this ensures lightdm succeeds when calling /org/freedesktop/AccountsServices ListCachedUsers
|
2022-10-21 06:41:52 +00:00
|
|
|
# lightdm greeters get the login users from lightdm which gets it from org.freedesktop.Accounts.ListCachedUsers.
|
|
|
|
# this requires the user we want to login as to be cached.
|
|
|
|
services.xserver.displayManager.job.preStart = ''
|
|
|
|
${pkgs.systemd}/bin/busctl call org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts CacheUser s colin
|
|
|
|
'';
|
2022-11-02 11:59:36 +00:00
|
|
|
# services.xserver.displayManager.defaultSession = "sm.puri.Phosh"; # XXX: not sure why this doesn't propagate correctly.
|
|
|
|
services.xserver.displayManager.lightdm.extraSeatDefaults = ''
|
|
|
|
user-session = phosh
|
|
|
|
'';
|
2022-11-02 11:13:41 +00:00
|
|
|
# services.xserver.displayManager.lightdm.greeters.gtk.enable = false; # gtk greeter overrides our own?
|
|
|
|
# services.xserver.displayManager.lightdm.greeter = {
|
|
|
|
# enable = true;
|
|
|
|
# package = pkgs.lightdm-mobile-greeter.xgreeters;
|
|
|
|
# name = "lightdm-mobile-greeter";
|
|
|
|
# };
|
|
|
|
# # services.xserver.displayManager.lightdm.enable = true;
|
|
|
|
|
|
|
|
services.xserver.displayManager.lightdm.enable = true;
|
|
|
|
services.xserver.displayManager.lightdm.greeters.mobile.enable = true;
|
2022-10-19 15:12:56 +00:00
|
|
|
|
|
|
|
systemd.services.phosh.wantedBy = lib.mkForce []; # disable auto-start
|
2022-10-19 12:18:13 +00:00
|
|
|
})
|
|
|
|
]);
|
2022-06-07 00:39:40 +00:00
|
|
|
}
|