mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-11 10:16:01 +01:00
Until now, the `cosmic-session` binary was directly invoked when
autologin was enabled. When a user logs in normally, the COSMIC greeter
performs some initialisation. That is done by the greeter running the
`start-cosmic` script shipping with the `cosmic-session` package.
This `start-cosmic` script is responsible for exporting the environment
variables for the user's graphical session and then it starts a session
of COSMIC.
So, when autologin is enabled, instead of executing the `cosmic-session`
binary, we will run the `start-cosmic` script to match user session
initialisation as closely as possible with a "normal" session.
However, there still are some missing pieces to the puzzle. Most notable
one of them is that the desktop portal keeps crashing with a
"ParserError" in context to the locale. I have not dived into this
puzzle piece yet.
```
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.351100Z INFO launch_pad: starting process ' WAYLAND_DISPLAY=wayland-1 XDG_SESSION_TYPE=wayland WAYLAND_SOCKET=79 PORTAL_WAYLAND_SOCKET=57 /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic '
May 30 09:32:26 aatman cosmic-session[1221]: starting process ' WAYLAND_DISPLAY=wayland-1 XDG_SESSION_TYPE=wayland WAYLAND_SOCKET=79 PORTAL_WAYLAND_SOCKET=57 /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic '
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.419931Z WARN xdg-desktop-portal-cosmic: cosmic_session: [2025-05-30T04:02:26Z ERROR i18n_embed::requester] Unable to parse your locale: ParserError(InvalidLanguage)
May 30 09:32:26 aatman cosmic-session[1221]: [2025-05-30T04:02:26Z ERROR cosmic_settings_subscriptions::upower::kbdbacklight] Error listening to KbdBacklight: org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/org/freedesktop/UPower/KbdBacklight”
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.795301Z WARN cosmic-osd: cosmic_session: [2025-05-30T04:02:26Z ERROR cosmic_settings_subscriptions::upower::kbdbacklight] Error listening to KbdBacklight: org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/org/freedesktop/UPower/KbdBacklight”
May 30 09:32:26 aatman cosmic-session[1221]: Failed to watch theme org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.GeoClue2 was not provided by any .service files
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.807276Z WARN cosmic-settings-daemon: cosmic_session: Failed to watch theme org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.GeoClue2 was not provided by any .service files
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.818729Z WARN xdg-desktop-portal-cosmic: cosmic_session:
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.818739Z WARN xdg-desktop-portal-cosmic: cosmic_session: thread 'main' panicked at src/wayland/mod.rs:243:78:
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.818748Z WARN xdg-desktop-portal-cosmic: cosmic_session: called `Result::unwrap()` on an `Err` value: NotPresent
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.818792Z WARN xdg-desktop-portal-cosmic: cosmic_session: stack backtrace:
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.830400Z WARN xdg-desktop-portal-cosmic: cosmic_session: 0: 0x56531e8a3e40 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9edbd6e38a8b0805
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.830424Z WARN xdg-desktop-portal-cosmic: cosmic_session: 1: 0x56531dd73043 - core::fmt::write::h7b1248e5e0c79c78
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.830499Z WARN xdg-desktop-portal-cosmic: cosmic_session: 2: 0x56531e86c0f3 - std::io::Write::write_fmt::h5e301665499081bf
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.831166Z WARN xdg-desktop-portal-cosmic: cosmic_session: 3: 0x56531e8a3ce3 - std::sys::backtrace::BacktraceLock::print::h4a386d2ef944f43e
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.831187Z WARN xdg-desktop-portal-cosmic: cosmic_session: 4: 0x56531e89ea7a - std::panicking::default_hook::{{closure}}::h61b7aa0fc15f236b
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.831825Z WARN xdg-desktop-portal-cosmic: cosmic_session: 5: 0x56531e89e986 - std::panicking::default_hook::h2d21379b0b23a14f
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.832324Z WARN xdg-desktop-portal-cosmic: cosmic_session: 6: 0x56531e89ef8f - std::panicking::rust_panic_with_hook::h100726ba9570b85a
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.832346Z WARN xdg-desktop-portal-cosmic: cosmic_session: 7: 0x56531e8a442a - std::panicking::begin_panic_handler::{{closure}}::h141712493bfacf0c
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.832762Z WARN xdg-desktop-portal-cosmic: cosmic_session: 8: 0x56531e8a4049 - std::sys::backtrace::__rust_end_short_backtrace::h891003731531c924
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.833229Z WARN xdg-desktop-portal-cosmic: cosmic_session: 9: 0x56531e89eb1d - rust_begin_unwind
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.834168Z WARN xdg-desktop-portal-cosmic: cosmic_session: 10: 0x56531dc22850 - core::panicking::panic_fmt::h1df68d570cb2382b
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.834420Z WARN xdg-desktop-portal-cosmic: cosmic_session: 11: 0x56531dc22f86 - core::result::unwrap_failed::h846e3c141fa2fc46
May 30 09:32:26 aatman cosmic-session[1221]: 12: 0x56531ef28d26 - xdg_desktop_portal_cosmic::wayland::WaylandHelper:🆕:h48f2051b910dbe32
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.835752Z WARN xdg-desktop-portal-cosmic: cosmic_session: 12: 0x56531ef28d26 - xdg_desktop_portal_cosmic::wayland::WaylandHelper:🆕:h48f2051b910dbe32
May 30 09:32:26 aatman cosmic-session[1221]: 13: 0x56531f156919 - <xdg_desktop_portal_cosmic::app::CosmicPortal as cosmic::app::Application>::init::had2439c596d5d3ad
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.836584Z WARN xdg-desktop-portal-cosmic: cosmic_session: 13: 0x56531f156919 - <xdg_desktop_portal_cosmic::app::CosmicPortal as cosmic::app::Application>::init::had2439c596d5d3ad
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.836608Z WARN xdg-desktop-portal-cosmic: cosmic_session: 14: 0x56531f0efc8a - cosmic::app::cosmic::Cosmic<T>::init::h237ea438ab62a4a6
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.837122Z WARN xdg-desktop-portal-cosmic: cosmic_session: 15: 0x56531f2343fc - <cosmic::executor::single::Executor as iced_futures::executor::Executor>::enter::hb58da647315361c8
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.837736Z WARN xdg-desktop-portal-cosmic: cosmic_session: 16: 0x56531f27721b - iced_winit::program::run::hf8da91cb177f3cdc
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.837766Z WARN xdg-desktop-portal-cosmic: cosmic_session: 17: 0x56531ef9367c - iced::program::Program::run_with::h07cb6de026d46c3f
May 30 09:32:26 aatman cosmic-session[1221]: 19: 0x56531f1568af - xdg_desktop_portal_cosmic::app::run::h7170177d90ae0389
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.838448Z WARN xdg-desktop-portal-cosmic: cosmic_session: 18: 0x56531ef6742e - cosmic::app::run::hd504699db0c811e4
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.838459Z WARN xdg-desktop-portal-cosmic: cosmic_session: 19: 0x56531f1568af - xdg_desktop_portal_cosmic::app::run::h7170177d90ae0389
May 30 09:32:26 aatman cosmic-session[1221]: 20: 0x56531efd2d97 - xdg_desktop_portal_cosmic::main::{{closure}}::hc5e7222eb3d3d40e
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.839054Z WARN xdg-desktop-portal-cosmic: cosmic_session: 20: 0x56531efd2d97 - xdg_desktop_portal_cosmic::main::{{closure}}::hc5e7222eb3d3d40e
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.839445Z WARN xdg-desktop-portal-cosmic: cosmic_session: 21: 0x56531f2f35c8 - tokio::runtime::scheduler::current_thread::Context::enter::hd6c32d98c7a2c763
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.839471Z WARN xdg-desktop-portal-cosmic: cosmic_session: 22: 0x56531eee89f5 - tokio::runtime::context::scoped::Scoped<T>::set::hbeefc0e3683e97df
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.840043Z WARN xdg-desktop-portal-cosmic: cosmic_session: 23: 0x56531f2f20d1 - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::h62fe74dc45c2b83b
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.840971Z WARN xdg-desktop-portal-cosmic: cosmic_session: 24: 0x56531f224371 - tokio::runtime::runtime::Runtime::block_on::hfa5a1859076bed6c
May 30 09:32:26 aatman cosmic-session[1221]: 25: 0x56531efd2a49 - xdg_desktop_portal_cosmic::main::h37b3a492c461a668
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.841689Z WARN xdg-desktop-portal-cosmic: cosmic_session: 25: 0x56531efd2a49 - xdg_desktop_portal_cosmic::main::h37b3a492c461a668
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.841783Z WARN xdg-desktop-portal-cosmic: cosmic_session: 26: 0x56531f15e686 - std::sys::backtrace::__rust_begin_short_backtrace::h4a22c4aac199bf89
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.841946Z WARN xdg-desktop-portal-cosmic: cosmic_session: 27: 0x56531f20de35 - std::rt::lang_start::{{closure}}::hd13242c87ee797d9
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.842593Z WARN xdg-desktop-portal-cosmic: cosmic_session: 28: 0x56531e87a336 - std::rt::lang_start_internal::he3cad277a2bdfe30
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.843329Z WARN xdg-desktop-portal-cosmic: cosmic_session: 29: 0x56531efd2ecc - main
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.844213Z WARN xdg-desktop-portal-cosmic: cosmic_session: 30: 0x7ff514e2a47e - __libc_start_call_main
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.844326Z WARN xdg-desktop-portal-cosmic: cosmic_session: 31: 0x7ff514e2a539 - __libc_start_main_impl
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.844695Z WARN xdg-desktop-portal-cosmic: cosmic_session: 32: 0x56531dc9b795 - _start
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.844761Z WARN xdg-desktop-portal-cosmic: cosmic_session: 33: 0x0 - <unknown>
May 30 09:32:26 aatman cosmic-session[1221]: process ' WAYLAND_DISPLAY=wayland-1 XDG_SESSION_TYPE=wayland WAYLAND_SOCKET=79 PORTAL_WAYLAND_SOCKET=57 /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic ' failed with code 101
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.855339Z ERROR launch_pad: process ' WAYLAND_DISPLAY=wayland-1 XDG_SESSION_TYPE=wayland WAYLAND_SOCKET=79 PORTAL_WAYLAND_SOCKET=57 /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic ' failed with code 101
May 30 09:32:26 aatman cosmic-session[1221]: /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic exited with error 101
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.855496Z ERROR cosmic_session: /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic exited with error 101
May 30 09:32:26 aatman cosmic-session[1221]: sleeping for 3ms before restarting process /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic (restart 0)
May 30 09:32:26 aatman cosmic-session[1221]: 2025-05-30T04:02:26.855749Z INFO launch_pad: sleeping for 3ms before restarting process /nix/store/0d2a9m7n8bji1q8vrmabj380mwzlvd35-xdg-desktop-portal-cosmic-1.0.0-alpha.7/libexec/xdg-desktop-portal-cosmic (restart 0
```
(cherry picked from commit e3f752e29d)
71 lines
2.2 KiB
Nix
71 lines
2.2 KiB
Nix
# SPDX-License-Identifier: MIT
|
|
# SPDX-FileCopyrightText: Lily Foster <lily@lily.flowers>
|
|
# Portions of this code are adapted from nixos-cosmic
|
|
# https://github.com/lilyinstarlight/nixos-cosmic
|
|
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.displayManager.cosmic-greeter;
|
|
cfgAutoLogin = config.services.displayManager.autoLogin;
|
|
in
|
|
|
|
{
|
|
meta.maintainers = lib.teams.cosmic.members;
|
|
|
|
options.services.displayManager.cosmic-greeter = {
|
|
enable = lib.mkEnableOption "COSMIC greeter";
|
|
package = lib.mkPackageOption pkgs "cosmic-greeter" { };
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.greetd = {
|
|
enable = true;
|
|
settings = {
|
|
default_session = {
|
|
user = "cosmic-greeter";
|
|
command = ''${lib.getExe' pkgs.coreutils "env"} XCURSOR_THEME="''${XCURSOR_THEME:-Pop}" systemd-cat -t cosmic-greeter ${lib.getExe pkgs.cosmic-comp} ${lib.getExe cfg.package}'';
|
|
};
|
|
initial_session = lib.mkIf (cfgAutoLogin.enable && (cfgAutoLogin.user != null)) {
|
|
user = cfgAutoLogin.user;
|
|
command = ''${lib.getExe' pkgs.coreutils "env"} XCURSOR_THEME="''${XCURSOR_THEME:-Pop}" systemd-cat -t cosmic-session ${lib.getExe' pkgs.cosmic-session "start-cosmic"}'';
|
|
};
|
|
};
|
|
};
|
|
|
|
# Daemon for querying background state and such
|
|
systemd.services.cosmic-greeter-daemon = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
before = [ "greetd.service" ];
|
|
serviceConfig = {
|
|
Type = "dbus";
|
|
BusName = "com.system76.CosmicGreeter";
|
|
ExecStart = lib.getExe' cfg.package "cosmic-greeter-daemon";
|
|
Restart = "on-failure";
|
|
};
|
|
};
|
|
|
|
# The greeter user is hardcoded in `cosmic-greeter`
|
|
users.groups.cosmic-greeter = { };
|
|
users.users.cosmic-greeter = {
|
|
description = "COSMIC login greeter user";
|
|
isSystemUser = true;
|
|
home = "/var/lib/cosmic-greeter";
|
|
createHome = true;
|
|
group = "cosmic-greeter";
|
|
};
|
|
# Required for authentication
|
|
security.pam.services.cosmic-greeter = { };
|
|
|
|
hardware.graphics.enable = true;
|
|
services.accounts-daemon.enable = true;
|
|
services.dbus.packages = [ cfg.package ];
|
|
services.libinput.enable = true;
|
|
};
|
|
}
|