summaryrefslogtreecommitdiff
path: root/hyprpm/src/helpers
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-02-10 15:12:43 +0000
committerGitHub <noreply@github.com>2026-02-10 15:12:43 +0000
commit857a78ce4ebd7b397d6f56d1436c4f06a99be9fc (patch)
tree78d70a20b4d64bfd2fabd25834091932002b1786 /hyprpm/src/helpers
parent339661229dd65161ec904fdc73390316a095bd46 (diff)
hyprpm: add full nix integration (#13189)
Adds nix integration to hyprpm: hyprpm will now detect nix'd hyprland and use nix develop instead --------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'hyprpm/src/helpers')
-rw-r--r--hyprpm/src/helpers/Sys.cpp10
-rw-r--r--hyprpm/src/helpers/Sys.hpp10
2 files changed, 13 insertions, 7 deletions
diff --git a/hyprpm/src/helpers/Sys.cpp b/hyprpm/src/helpers/Sys.cpp
index c18d4748..e9dd4c85 100644
--- a/hyprpm/src/helpers/Sys.cpp
+++ b/hyprpm/src/helpers/Sys.cpp
@@ -35,9 +35,13 @@ static std::string validSubinsAsStr() {
}
static bool executableExistsInPath(const std::string& exe) {
+ return NSys::findInPath(exe).has_value();
+}
+
+std::optional<std::string> NSys::findInPath(const std::string& exe) {
const char* PATHENV = std::getenv("PATH");
if (!PATHENV)
- return false;
+ return std::nullopt;
CVarList paths(PATHENV, 0, ':', true);
std::error_code ec;
@@ -52,10 +56,10 @@ static bool executableExistsInPath(const std::string& exe) {
if (ec)
continue;
if ((perms & std::filesystem::perms::others_exec) != std::filesystem::perms::none)
- return true;
+ return candidate.string();
}
- return false;
+ return std::nullopt;
}
static std::string subin() {
diff --git a/hyprpm/src/helpers/Sys.hpp b/hyprpm/src/helpers/Sys.hpp
index b44eb758..03d5a0de 100644
--- a/hyprpm/src/helpers/Sys.hpp
+++ b/hyprpm/src/helpers/Sys.hpp
@@ -1,11 +1,13 @@
#pragma once
#include <string>
+#include <optional>
namespace NSys {
- bool isSuperuser();
- int getUID();
- int getEUID();
+ bool isSuperuser();
+ int getUID();
+ int getEUID();
+ std::optional<std::string> findInPath(const std::string& exe);
// NOLINTNEXTLINE
namespace root {
@@ -20,4 +22,4 @@ namespace NSys {
// Do not use this unless absolutely necessary!
std::string runAsSuperuserUnsafe(const std::string& cmd);
};
-}; \ No newline at end of file
+};