nixos/settings/desktop.nix

126 lines
5.7 KiB
Nix
Raw Normal View History

# settings/desktop.nix — display manager, lightweight fallback session, GTK/Qt theming
{ config, pkgs, lib, inputs, ... }:
2025-12-03 15:46:37 +00:00
{
2026-01-09 13:09:34 +00:00
config = lib.mkIf (lib.elem config.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ]) {
2026-01-05 09:25:10 +00:00
services.xserver.enable = true;
# Autologin straight into Hyprland; the quickshell lockscreen engages
# immediately (see Lock.qml), so the lock *is* the login prompt.
services.greetd = {
enable = true;
# We handle the plymouth handoff ourselves below — don't wait for
# plymouth-quit-wait (that wait is what dropped boot to a console
# flash between splash and Hyprland).
greeterManagesPlymouth = true;
settings.default_session = {
# start-hyprland prints an ASCII logo to the VT, which repaints the
# console over the retained splash frame — silence it (Hyprland still
# logs to $XDG_RUNTIME_DIR/hypr/*/hyprland.log).
command = toString (pkgs.writeShellScript "hyprland-session" ''
exec ${config.programs.hyprland.package}/bin/start-hyprland >/dev/null 2>&1
'');
user = "fred";
};
};
# GDM-style splash→session handoff: nothing else quits plymouth at boot;
# greetd freezes the last splash frame (--retain-splash) right before it
# spawns Hyprland, which then flips straight to the lockscreen.
systemd.services.plymouth-quit.wantedBy = lib.mkForce [ ];
# ...and plymouth-quit-wait must go too: greetd is Type=idle, so it defers
# its ExecStart while any job is pending — and the only pending job is
# plymouth-quit-wait, which waits for the splash that greetd itself quits.
# That circle only broke on systemd's 5s idle timeout, costing 6s of boot.
systemd.services.plymouth-quit-wait.wantedBy = lib.mkForce [ ];
systemd.services.greetd = {
after = [ "plymouth-start.service" ];
serviceConfig.ExecStartPre = "-${pkgs.plymouth}/bin/plymouth quit --retain-splash";
};
boot.plymouth.enable = true;
boot.initrd.verbose = false;
boot.consoleLogLevel = 3;
boot.kernelParams = [ "quiet" "udev.log_level=3" ];
# Flatpak for ad-hoc app installs via Bazaar
services.flatpak.enable = true;
# Secret Service for Chromium/Electron credential encryption.
# Autologin can't unlock the keyring (no password typed), so greetd only
# *starts* the daemon; the quickshell lockscreen authenticates against the
# "login" PAM service, where pam_gnome_keyring unlocks it on first unlock.
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd.enableGnomeKeyring = true;
security.pam.services.login.enableGnomeKeyring = true;
2026-01-05 09:25:10 +00:00
environment.systemPackages = with pkgs; [
nemo # file manager
2026-01-20 08:35:23 +00:00
gnome-themes-extra
papirus-icon-theme
2026-01-05 09:25:10 +00:00
];
2026-01-11 22:29:04 +00:00
# Cursor theme — stylix.cursor in settings/stylix.nix owns the choice.
2026-01-05 09:25:10 +00:00
environment.sessionVariables = {
XCURSOR_THEME = "Bibata-Modern-Ice";
2026-01-05 09:25:10 +00:00
XCURSOR_SIZE = "24";
XCURSOR_PATH = lib.mkForce [
"${pkgs.bibata-cursors}/share/icons"
2026-01-05 09:25:10 +00:00
"$HOME/.icons"
"$HOME/.local/share/icons"
];
};
2026-01-05 09:25:10 +00:00
programs.xwayland.enable = true;
programs.dconf.enable = true;
home-manager.users.fred = { config, lib, pkgs, ... }: let
# Scaling all three channels by the same factor is exactly what
# Qt.lighter() does — hue and HSV saturation stay put, only value moves —
# so this lands on the same surfaces as quickshell's Theme.base01/base02.
# GTK's own shade() can't stand in: it multiplies saturation too.
tint = f: let
ch = k: toString (builtins.floor (builtins.fromJSON config.lib.stylix.colors."base00-rgb-${k}" * f));
in "rgb(${ch "r"}, ${ch "g"}, ${ch "b"})";
in {
2026-05-14 14:58:13 +01:00
# Stylix's qt target only supports qtct; disable it to silence the warning.
stylix.targets.qt.enable = false;
# Minimal titlebars — stylix manages the GTK theme; we layer our
# headerbar shrink on top via stylix.targets.gtk.extraCss.
gtk.enable = true;
dconf.settings."org/nemo/window-state".start-with-menu-bar = false;
# GTK3 ignores dconf's color-scheme=prefer-dark — it only picks
# adw-gtk3's gtk-dark.css when this setting is on. Without it GTK3 apps
# (nemo) load the *light* sheet; stylix's @define-color overrides repaint
# most of it, but colours sass baked in as literals survive — e.g.
# `messagedialog.csd.background button { color: rgba(0,0,6,0.8); }`, which
# is why nemo's delete confirmation had near-black buttons on dark bg.
gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme = true;
stylix.targets.gtk.extraCss = ''
/* Surfaces: one hue, three steps the same ladder quickshell's Theme
uses (settings/quickshell.nix, commit e2c413d). Stylix paints every
raised surface with base01/base02, which come straight off the
wallpaper and routinely land off-hue: base01 is #3f3fab purple over a
slate #1c1f26 desktop, which is why nemo's delete dialog was blue. */
@define-color headerbar_bg_color ${tint 1.7};
@define-color sidebar_bg_color ${tint 1.7};
@define-color card_bg_color ${tint 1.7};
@define-color dialog_bg_color ${tint 1.7};
@define-color popover_bg_color ${tint 1.7};
@define-color scrollbar_outline_color ${tint 2.4};
headerbar { min-height: 0; padding: 0; margin: 0; }
headerbar .title { font-size: 0; }
window:backdrop {
background-color: @window_bg_color;
color: @window_fg_color;
}
window:backdrop headerbar {
background-color: @headerbar_bg_color;
color: @headerbar_fg_color;
}
'';
};
2026-01-05 09:25:10 +00:00
};
2025-12-03 15:46:37 +00:00
}