Add NoDM (display session autostart config)
This commit is contained in:
parent
0c58a9ea1b
commit
2144789bb2
@ -2,5 +2,6 @@
|
||||
{
|
||||
imports = [
|
||||
./wm.nix
|
||||
./nodm.nix
|
||||
];
|
||||
}
|
||||
|
31
home/common/nodm.nix
Normal file
31
home/common/nodm.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{ lib, pkgs, config, osConfig ? {}, options, ... }:
|
||||
let
|
||||
cfg = config.nixfiles.common.nodm;
|
||||
in
|
||||
{
|
||||
config = let
|
||||
hyprland="${config.wayland.windowManager.hyprland.finalPackage}/bin/Hyprland";
|
||||
tty="${pkgs.coreutils}/bin/tty";
|
||||
initCommands =
|
||||
''
|
||||
if [[ "$(${tty})" == "/dev/tty1" && -z "''${WAYLAND_DISPLAY:+x}" ]] ; then
|
||||
${hyprland}
|
||||
fi
|
||||
'';
|
||||
in lib.mkIf cfg.enable {
|
||||
# auto start Hyprland on tty1
|
||||
programs.zsh.initExtra = initCommands;
|
||||
programs.bash.initExtra = initCommands;
|
||||
};
|
||||
|
||||
options.nixfiles.common.nodm = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
description = "Whether to automatically start a desktop session on TTY1, behaving like a rudimentary display manager.";
|
||||
default = osConfig ? systemd
|
||||
&& config.nixfiles.meta.graphical
|
||||
&& (!(osConfig.systemd.services.display-manager.enable or false));
|
||||
example = true;
|
||||
};
|
||||
};
|
||||
}
|
@ -59,6 +59,9 @@
|
||||
packageSets.gaming.enable = true;
|
||||
};
|
||||
|
||||
services.xserver.displayManager.sddm.enable = false;
|
||||
services.xserver.displayManager.startx.enable = true;
|
||||
|
||||
# bootloader setup
|
||||
boot.loader = {
|
||||
efi = {
|
||||
|
@ -10,16 +10,6 @@
|
||||
};
|
||||
home.stateVersion = "23.11";
|
||||
|
||||
# auto start Hyprland on tty1
|
||||
programs.zsh.initExtraFirst = let
|
||||
hyprland="${config.wayland.windowManager.hyprland.finalPackage}/bin/Hyprland";
|
||||
tty="${pkgs.coreutils}/bin/tty";
|
||||
in lib.mkIf config.wayland.windowManager.hyprland.enable ''
|
||||
if [[ "$(${tty})" == "/dev/tty1" && -z "''${WAYLAND_DISPLAY:+x}" ]] ; then
|
||||
${hyprland}
|
||||
fi
|
||||
'';
|
||||
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
monitor = ",preferred,auto,1.25";
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user