9 dmcfg = config.services.displayManager;
10 xcfg = config.services.xserver;
11 xdmcfg = xcfg.displayManager;
12 cfg = config.services.displayManager.ly;
13 xEnv = config.systemd.services.display-manager.environment;
17 iniFmt = pkgs.formats.iniWithGlobalSection { };
29 xserverWrapper = pkgs.writeShellScript "xserver-wrapper" ''
30 ${concatMapStrings (n: ''
31 export ${n}="${getAttr n xEnv}"
33 exec systemd-cat -t xserver-wrapper ${xdmcfg.xserverBin} ${toString xdmcfg.xserverArgs} "$@"
37 shutdown_cmd = "/run/current-system/systemd/bin/systemctl poweroff";
38 restart_cmd = "/run/current-system/systemd/bin/systemctl reboot";
41 path = "/run/current-system/sw/bin";
42 term_reset_cmd = "${pkgs.ncurses}/bin/tput reset";
43 term_restore_cursor_cmd = "${pkgs.ncurses}/bin/tput cnorm";
44 mcookie_cmd = "/run/current-system/sw/bin/mcookie";
45 waylandsessions = "${dmcfg.sessionData.desktops}/share/wayland-sessions";
46 wayland_cmd = dmcfg.sessionData.wrapper;
47 xsessions = "${dmcfg.sessionData.desktops}/share/xsessions";
48 xauth_cmd = lib.optionalString xcfg.enable "${pkgs.xorg.xauth}/bin/xauth";
49 x_cmd = lib.optionalString xcfg.enable xserverWrapper;
50 x_cmd_setup = dmcfg.sessionData.wrapper;
53 finalConfig = defaultConfig // cfg.settings;
55 cfgFile = iniFmt.generate "config.ini" { globalSection = finalConfig; };
60 services.displayManager.ly = {
61 enable = mkEnableOption "ly as the display manager";
63 package = mkPackageOption pkgs [ "ly" ] { };
79 Extra settings merged in and overwriting defaults in config.ini.
85 config = mkIf cfg.enable {
89 assertion = !dmcfg.autoLogin.enable;
91 ly doesn't support auto login.
96 security.pam.services.ly = {
99 enableGnomeKeyring = lib.mkDefault config.services.gnome.gnome-keyring.enable;
103 etc."ly/config.ini".source = cfgFile;
104 systemPackages = [ ly ];
106 pathsToLink = [ "/share/ly" ];
110 dbus.packages = [ ly ];
114 execCmd = "exec /run/current-system/sw/bin/ly";
118 # To enable user switching, allow ly to allocate TTYs/displays dynamically.
125 # We're not using the upstream unit, so copy these:
126 # https://github.com/fairyglade/ly/blob/master/res/ly.service
127 services.display-manager = {
129 "systemd-user-sessions.service"
130 "plymouth-quit-wait.service"
131 "getty@tty${toString finalConfig.tty}.service"
134 conflicts = [ "getty@tty7.service" ];
138 StandardInput = "tty";
139 TTYPath = "/dev/tty${toString finalConfig.tty}";
147 meta.maintainers = with lib.maintainers; [ vonfry ];