File tree Expand file tree Collapse file tree 3 files changed +13
-18
lines changed Expand file tree Collapse file tree 3 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,15 @@ function main(opt)
45
45
local nix_paths = {
46
46
" /nix/var/nix/profiles/default/bin" , -- multi-user installation
47
47
" /home/" .. (os.getenv (" USER" ) or " user" ) .. " /.nix-profile/bin" , -- single user installation
48
- " /run/current-system/sw/bin" , -- only on nixos, maybe separate nix logic from nixos logic?
49
48
" /usr/local/bin" , -- default path of nix when compiling nix from source
50
49
}
50
+
51
+ -- NixOS-specific paths
52
+ if linuxos .name () == " nixos" then
53
+ table.insert (nix_paths , " /run/current-system/sw/bin" )
54
+ end
51
55
56
+ opt .paths = table .wrap (opt .paths )
52
57
for _ , nixpath in ipairs (nix_paths ) do
53
58
table.insert (opt .paths , nixpath )
54
59
end
Original file line number Diff line number Diff line change @@ -67,9 +67,7 @@ function _get_available_nix_paths()
67
67
-- Also check for manifest (generation info)
68
68
local manifest = path .join (location , " manifest.nix" )
69
69
if os .isfile (manifest ) then
70
- local manifest_content = try {function ()
71
- return io .readfile (manifest )
72
- end }
70
+ local manifest_content = io .readfile (manifest )
73
71
74
72
if manifest_content then
75
73
-- Extract store paths from manifest
@@ -142,17 +140,8 @@ function _find_in_store_path(store_path, name)
142
140
if os .isdir (pcdir ) then
143
141
local pcfiles = os .files (path .join (pcdir , name .. " .pc" ))
144
142
if # pcfiles > 0 then
145
- -- Use pkg-config to get proper info
146
- local old_path = os.getenv (" PKG_CONFIG_PATH" )
147
- os .setenv (" PKG_CONFIG_PATH" , pcdir .. (old_path and (" :" .. old_path ) or " " ))
148
-
149
- local pcresult = find_package_from_pkgconfig (name )
150
-
151
- if old_path then
152
- os .setenv (" PKG_CONFIG_PATH" , old_path )
153
- else
154
- os .setenv (" PKG_CONFIG_PATH" , nil )
155
- end
143
+ -- Use pkg-config with configdirs
144
+ local pcresult = find_package_from_pkgconfig (name , {configdirs = pcdir })
156
145
157
146
if pcresult then
158
147
return pcresult
Original file line number Diff line number Diff line change 21
21
-- imports
22
22
import (" core.base.option" )
23
23
import (" lib.detect.find_tool" )
24
+ import (" private.core.base.is_cross" )
24
25
25
26
-- install package
26
27
--
@@ -39,9 +40,9 @@ function main(name, opt)
39
40
raise (" nix not found!" )
40
41
end
41
42
42
- -- check architecture (nix supports cross compilation but for simplicity...)
43
- if opt .arch ~= os .arch ( ) then
44
- raise (" cannot install package(%s) for arch(%s) !" , name , opt . arch )
43
+ -- check architecture
44
+ if is_cross ( opt .plat , opt .arch ) then
45
+ raise (" cannot install package(%s) for cross compilation !" , name )
45
46
end
46
47
47
48
local success = false
You can’t perform that action at this time.
0 commit comments