From 836856604407da41e1c38324abd812b7884637b8 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 8 Jan 2026 10:57:56 +0100 Subject: start: use nixGL if Hyprland is nix but not NixOS (#12845) --------- Co-authored-by: Mihai Fufezan --- start/src/main.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'start/src/main.cpp') diff --git a/start/src/main.cpp b/start/src/main.cpp index 74de393c..e73fcfa5 100644 --- a/start/src/main.cpp +++ b/start/src/main.cpp @@ -3,6 +3,7 @@ #include #include "helpers/Logger.hpp" +#include "helpers/Nix.hpp" #include "core/State.hpp" #include "core/Instance.hpp" @@ -16,7 +17,12 @@ using namespace Hyprutils::CLI; } constexpr const char* HELP_INFO = R"#(start-hyprland - A binary to properly start Hyprland via a watchdog process. -Any arguments after -- are passed to Hyprland. For Hyprland help, run start-hyprland -- --help or Hyprland --help)#"; +Any arguments after -- are passed to Hyprland. For Hyprland help, run start-hyprland -- --help or Hyprland --help + +Additional arguments for start-hyprland: + --path [path] -> Override Hyprland path + --no-nixgl -> Force disable nixGL +)#"; // static void onSignal(int sig) { @@ -69,6 +75,10 @@ int main(int argc, const char** argv, const char** envp) { g_state->customPath = argv[++i]; continue; } + if (arg == "--no-nixgl") { + g_state->noNixGl = true; + continue; + } } if (startArgv != -1) @@ -77,6 +87,15 @@ int main(int argc, const char** argv, const char** envp) { if (!g_state->rawArgvNoBinPath.empty()) g_logger->log(Hyprutils::CLI::LOG_WARN, "Arguments after -- are passed to Hyprland"); + // check if our environment is OK + if (const auto RET = Nix::nixEnvironmentOk(); !RET) { + g_logger->log(Hyprutils::CLI::LOG_ERR, "Nix environment check failed:\n{}", RET.error()); + return 1; + } + + if (Nix::shouldUseNixGL()) + g_logger->log(Hyprutils::CLI::LOG_DEBUG, "Hyprland was compiled with Nix - will use nixGL"); + bool safeMode = false; while (true) { g_instance = makeUnique(); -- cgit v1.2.3