From 394d40f601634b258e4bc8faf8d03f6332d80587 Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.dev>
Date: Tue, 18 Feb 2025 12:24:39 +0000
Subject: [PATCH] Automatically run startx on login

---
 nix/modules/home-manager/features/cli/zsh.nix | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/nix/modules/home-manager/features/cli/zsh.nix b/nix/modules/home-manager/features/cli/zsh.nix
index 4ca17eea..eec1fb43 100644
--- a/nix/modules/home-manager/features/cli/zsh.nix
+++ b/nix/modules/home-manager/features/cli/zsh.nix
@@ -22,6 +22,10 @@
     };
 
     initExtra = ''
+      if [[ -z "$DISPLAY" ]] && [[ "$(tty)" == "/dev/tty1" ]]; then
+        exec startx &>/dev/null
+      fi
+
       # suffix
       alias -s gz="tar -tf"
       alias -s {html,HTML}="background firefox"