From 32b67fe06229fb39023fd8ca4b6d8ed3342e2df4 Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 1 Nov 2022 05:31:48 -0700 Subject: [PATCH 1/2] lightdm-mobile-greeter: init at 2022-10-30 this is a greeter designed for mobile hardware. although most mobile DEs are capable of running without an external greeter by using their own lock screens, those tend to have different limitations. for example, the lock screen in Phosh doesn't do PAM session management -- but by using this lightdm-mobile-greeter which integrates with PAM, one can do things like decrypt a home directory or unlock keys on login. the upstream project lacks many images/videos, so here's what the software looks like: --- .../lightdm-mobile-greeter/default.nix | 53 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 55 insertions(+) create mode 100644 pkgs/applications/display-managers/lightdm-mobile-greeter/default.nix diff --git a/pkgs/applications/display-managers/lightdm-mobile-greeter/default.nix b/pkgs/applications/display-managers/lightdm-mobile-greeter/default.nix new file mode 100644 index 000000000000..a4ea16aa4a78 --- /dev/null +++ b/pkgs/applications/display-managers/lightdm-mobile-greeter/default.nix @@ -0,0 +1,53 @@ +{ lib +, fetchFromGitea +, gtk3 +, libhandy_0 +, lightdm +, lightdm-mobile-greeter +, linkFarm +, pkg-config +, rustPlatform +}: + +rustPlatform.buildRustPackage rec { + pname = "lightdm-mobile-greeter"; + version = "2022-10-30"; + + src = fetchFromGitea { + domain = "git.raatty.club"; + owner = "raatty"; + repo = "lightdm-mobile-greeter"; + rev = "8c8d6dfce62799307320c8c5a1f0dd5c8c18e4d3"; + hash = "sha256-SrAR2+An3BN/doFl/s8PcYZMUHLfVPXKZOo6ndO60nY="; + }; + cargoHash = "sha256-NZ0jOkEBNa5oOydfyKm0XQB/vkAvBv9wHBbnM9egQFQ="; + + buildInputs = [ + gtk3 + libhandy_0 + lightdm + ]; + nativeBuildInputs = [ + pkg-config + ]; + + postInstall = '' + mkdir -p $out/share/xgreeters + substitute lightdm-mobile-greeter.desktop \ + $out/share/xgreeters/lightdm-mobile-greeter.desktop \ + --replace lightdm-mobile-greeter $out/bin/lightdm-mobile-greeter + ''; + + passthru.xgreeters = linkFarm "lightdm-mobile-greeter-xgreeters" [{ + path = "${lightdm-mobile-greeter}/share/xgreeters/lightdm-mobile-greeter.desktop"; + name = "lightdm-mobile-greeter.desktop"; + }]; + + meta = with lib; { + description = "A simple log in screen for use on touch screens"; + homepage = "https://git.raatty.club/raatty/lightdm-mobile-greeter"; + maintainers = with maintainers; [ colinsane ]; + platforms = platforms.linux; + license = licenses.mit; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1965a7216afa..cd838fe4f843 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31888,6 +31888,8 @@ with pkgs; lightdm-mini-greeter = callPackage ../applications/display-managers/lightdm-mini-greeter { }; + lightdm-mobile-greeter = callPackage ../applications/display-managers/lightdm-mobile-greeter { }; + lightdm-tiny-greeter = callPackage ../applications/display-managers/lightdm-tiny-greeter { conf = config.lightdm-tiny-greeter.conf or ""; }; From ed9998cf2a5ebb181ee604d2f0a2b0c64718c082 Mon Sep 17 00:00:00 2001 From: colin Date: Wed, 2 Nov 2022 03:31:52 -0700 Subject: [PATCH 2/2] nixos/lightdm: add `greeters.mobile` config option i based this on the neighboring lightdm-greeters/mini.nix module. lightdm-mobile-greeter doesn't have a lot of configuration options. it grabs the default user to login as from lightdm, along with which DE it should launch. so no further configuration should be needed aside from enabling `services.xserver.displayManager.lightdm.enable` and either setting `services.xserver.displayManager.defaultSession` to the appropriate session or explicitly defining a seat like: ```nix services.xserver.displayManager.lightdm.extraSeatDefaults = '' user-session = phosh ''; ``` --- .../lightdm-greeters/mobile.nix | 26 +++++++++++++++++++ .../services/x11/display-managers/lightdm.nix | 1 + 2 files changed, 27 insertions(+) create mode 100644 nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix new file mode 100644 index 000000000000..31cc9b3deaa1 --- /dev/null +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/mobile.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + dmcfg = config.services.xserver.displayManager; + ldmcfg = dmcfg.lightdm; + cfg = ldmcfg.greeters.mobile; +in +{ + options = { + services.xserver.displayManager.lightdm.greeters.mobile = { + enable = mkEnableOption (lib.mdDoc + "lightdm-mobile-greeter as the lightdm greeter" + ); + }; + }; + + config = mkIf (ldmcfg.enable && cfg.enable) { + services.xserver.displayManager.lightdm.greeters.gtk.enable = false; + + services.xserver.displayManager.lightdm.greeter = mkDefault { + package = pkgs.lightdm-mobile-greeter.xgreeters; + name = "lightdm-mobile-greeter"; + }; + }; +} diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index b0508c3b4f79..f74e8efb8f64 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -83,6 +83,7 @@ in ./lightdm-greeters/pantheon.nix ./lightdm-greeters/tiny.nix ./lightdm-greeters/slick.nix + ./lightdm-greeters/mobile.nix (mkRenamedOptionModule [ "services" "xserver" "displayManager" "lightdm" "autoLogin" "enable" ] [ "services" "xserver"