summaryrefslogtreecommitdiff
path: root/start/src/main.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-01-08 10:57:56 +0100
committerGitHub <noreply@github.com>2026-01-08 10:57:56 +0100
commit836856604407da41e1c38324abd812b7884637b8 (patch)
tree87796eaead9481e1ce1a034ab8d90e4f4eba343d /start/src/main.cpp
parent918e2bb9be0e1d233f9394f1d569137788c43c01 (diff)
start: use nixGL if Hyprland is nix but not NixOS (#12845)
--------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'start/src/main.cpp')
-rw-r--r--start/src/main.cpp21
1 files changed, 20 insertions, 1 deletions
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 <print>
#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<CHyprlandInstance>();