Commit f1d1d3b
committed
nix: make System, Version, SourceProfile public
As part of some cleanup for making the DetSys installer the default,
move the code related to getting the Nix version and system to the
non-internal go.jetpack.io/devbox/nix package. It also merges in some
nearly-duplicate code from the search indexer's Nix code (which will
eventually use this package instead).
Some of the changes taken from the indexer are:
- Calling any function or method automatically...
- sources the Nix profile if necessary.
- looks for Nix in some well-known places if it isn't in PATH.
- `nix.Version` and `nix.System` are cached behind a `sync.Once` by
default.
All top-level functions map to a method on a default Nix struct,
following the same pattern found in `flags`, `slog`, etc.
const Version2_12 = "2.12.0" ...
func AtLeast(version string) bool
func SourceProfile() (sourced bool, err error)
func System() string
func Version() string
type Info struct{ ... }
type Nix struct{ ... }
func Default() *Nix
func LookPath() *Nix
func (n *Nix) Info() (Info, error)
func (n *Nix) System() string
func (n *Nix) Version() string1 parent 892add7 commit f1d1d3b
File tree
18 files changed
+671
-580
lines changed- internal
- devbox
- devpkg
- nix
- telemetry
- nix
18 files changed
+671
-580
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | 77 | | |
85 | 78 | | |
86 | 79 | | |
| |||
240 | 233 | | |
241 | 234 | | |
242 | 235 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | 236 | | |
249 | | - | |
250 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
251 | 240 | | |
252 | 241 | | |
253 | 242 | | |
254 | 243 | | |
255 | 244 | | |
256 | 245 | | |
257 | 246 | | |
258 | | - | |
259 | | - | |
260 | 247 | | |
261 | 248 | | |
262 | 249 | | |
263 | 250 | | |
264 | 251 | | |
265 | | - | |
| 252 | + | |
266 | 253 | | |
267 | 254 | | |
268 | 255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | | - | |
| 393 | + | |
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | | - | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | 124 | | |
132 | | - | |
| 125 | + | |
133 | 126 | | |
134 | 127 | | |
135 | 128 | | |
136 | 129 | | |
137 | | - | |
| 130 | + | |
138 | 131 | | |
139 | 132 | | |
140 | 133 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | 134 | | |
145 | 135 | | |
146 | 136 | | |
147 | 137 | | |
148 | 138 | | |
149 | 139 | | |
150 | | - | |
| 140 | + | |
151 | 141 | | |
152 | 142 | | |
153 | 143 | | |
| |||
174 | 164 | | |
175 | 165 | | |
176 | 166 | | |
177 | | - | |
| 167 | + | |
178 | 168 | | |
179 | 169 | | |
180 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments