summaryrefslogtreecommitdiff
path: root/xmake/modules/package
diff options
context:
space:
mode:
authorzzbaron <[email protected]>2025-09-11 10:58:06 -0400
committerzzbaron <[email protected]>2025-09-11 10:58:06 -0400
commit3d600264dc2ffab5deffc04237dba407deff6245 (patch)
tree8477394b7a524ccbb6044dbffcdbfb618b0be5a8 /xmake/modules/package
parenta5223dbe4e7c2eef1592b36d9450e5044b8c17b6 (diff)
nix support: adjustments pointed out by ruki
Diffstat (limited to 'xmake/modules/package')
-rw-r--r--xmake/modules/package/manager/nix/find_package.lua17
-rw-r--r--xmake/modules/package/manager/nix/install_package.lua7
2 files changed, 7 insertions, 17 deletions
diff --git a/xmake/modules/package/manager/nix/find_package.lua b/xmake/modules/package/manager/nix/find_package.lua
index 8c876e411..579156153 100644
--- a/xmake/modules/package/manager/nix/find_package.lua
+++ b/xmake/modules/package/manager/nix/find_package.lua
@@ -67,9 +67,7 @@ function _get_available_nix_paths()
-- Also check for manifest (generation info)
local manifest = path.join(location, "manifest.nix")
if os.isfile(manifest) then
- local manifest_content = try {function()
- return io.readfile(manifest)
- end}
+ local manifest_content = io.readfile(manifest)
if manifest_content then
-- Extract store paths from manifest
@@ -142,17 +140,8 @@ function _find_in_store_path(store_path, name)
if os.isdir(pcdir) then
local pcfiles = os.files(path.join(pcdir, name .. ".pc"))
if #pcfiles > 0 then
- -- Use pkg-config to get proper info
- local old_path = os.getenv("PKG_CONFIG_PATH")
- os.setenv("PKG_CONFIG_PATH", pcdir .. (old_path and (":" .. old_path) or ""))
-
- local pcresult = find_package_from_pkgconfig(name)
-
- if old_path then
- os.setenv("PKG_CONFIG_PATH", old_path)
- else
- os.setenv("PKG_CONFIG_PATH", nil)
- end
+ -- Use pkg-config with configdirs
+ local pcresult = find_package_from_pkgconfig(name, {configdirs = pcdir})
if pcresult then
return pcresult
diff --git a/xmake/modules/package/manager/nix/install_package.lua b/xmake/modules/package/manager/nix/install_package.lua
index 8350d3c9d..507cf6d13 100644
--- a/xmake/modules/package/manager/nix/install_package.lua
+++ b/xmake/modules/package/manager/nix/install_package.lua
@@ -21,6 +21,7 @@
-- imports
import("core.base.option")
import("lib.detect.find_tool")
+import("private.core.base.is_cross")
-- install package
--
@@ -39,9 +40,9 @@ function main(name, opt)
raise("nix not found!")
end
- -- check architecture (nix supports cross compilation but for simplicity...)
- if opt.arch ~= os.arch() then
- raise("cannot install package(%s) for arch(%s)!", name, opt.arch)
+ -- check architecture
+ if is_cross(opt.plat, opt.arch) then
+ raise("cannot install package(%s) for cross compilation!", name)
end
local success = false