| 1 |
#compdef guix |
| 2 |
# |
| 3 |
# GNU Guix --- Functional package management for GNU |
| 4 |
# Copyright © 2016 Eric Le Bihan <[email protected]> |
| 5 |
# Copyright © 2021 Noah Evans <[email protected]> |
| 6 |
# Copyright © 2021 Brice Waegeneire <[email protected]> |
| 7 |
# |
| 8 |
# This file is part of GNU Guix. |
| 9 |
# |
| 10 |
# GNU Guix is free software; you can redistribute it and/or modify it |
| 11 |
# under the terms of the GNU General Public License as published by |
| 12 |
# the Free Software Foundation; either version 3 of the License, or (at |
| 13 |
# your option) any later version. |
| 14 |
# |
| 15 |
# GNU Guix is distributed in the hope that it will be useful, but |
| 16 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
# GNU General Public License for more details. |
| 19 |
# |
| 20 |
# You should have received a copy of the GNU General Public License |
| 21 |
# along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 22 |
|
| 23 |
|
| 24 |
_guix_caching_policy() |
| 25 |
{ |
| 26 |
local -a old_policy |
| 27 |
old_policy=( "$1"(Nmh+24) ) |
| 28 |
(( $#old_policy )) |
| 29 |
} |
| 30 |
|
| 31 |
_guix_list_actions() |
| 32 |
{ |
| 33 |
_guix_actions=( $(guix system --help | sed -n 's/^ \([a-z-]\+\)\s\+.\+/\1/p') ) |
| 34 |
} |
| 35 |
|
| 36 |
_guix_list_checkers() |
| 37 |
{ |
| 38 |
_guix_checkers=( $(guix lint -l | sed -n 's/^- \(.\+\): .\+/\1/p') ) |
| 39 |
} |
| 40 |
|
| 41 |
_guix_list_graph_types() |
| 42 |
{ |
| 43 |
_guix_graph_types=( $(guix graph --list-types | sed -n 's/^ - \(.\+\): .\+/\1/p') ) |
| 44 |
} |
| 45 |
|
| 46 |
_guix_list_importers() |
| 47 |
{ |
| 48 |
_guix_importers=( $(guix import --help | sed -n 's/^\s\+\([a-z]\+\)$/\1/p') ) |
| 49 |
} |
| 50 |
|
| 51 |
_guix_list_updaters() |
| 52 |
{ |
| 53 |
_guix_updaters=( $(guix lint -l | sed -n 's/^- \(.\+\): .\+/\1/p') ) |
| 54 |
} |
| 55 |
|
| 56 |
_guix_list_available_packages() |
| 57 |
{ |
| 58 |
if ( [[ ${+_guix_available_packages} -eq 0 ]] || _cache_invalid GUIX_AVAILABLE_PACKAGES ) \ |
| 59 |
&& ! _retrieve_cache GUIX_AVAILABLE_PACKAGES; then |
| 60 |
_guix_available_packages=(${${(f)"$(guix package -A | cut -f1)"}}) |
| 61 |
_guix_available_packages=("${_guix_available_packages[@]// /}") |
| 62 |
_store_cache GUIX_AVAILABLE_PACKAGES _guix_available_packages |
| 63 |
fi |
| 64 |
} |
| 65 |
|
| 66 |
_guix_list_installed_packages() |
| 67 |
{ |
| 68 |
_guix_installed_packages=( $(guix package -I "^${prefix}" | cut -f1) ) |
| 69 |
} |
| 70 |
|
| 71 |
(( $+functions[_guix_build] )) || _guix_build() |
| 72 |
{ |
| 73 |
_arguments \ |
| 74 |
{-e,--expression=}'[build the package or derivation EXPR evaluates to]:EXPR' \ |
| 75 |
{-f,--file=}'[build the package or derivation that the code within FILE evaluates to]:FILE:_files' \ |
| 76 |
{-m,--manifest=}'[build the packages that the manifest given in FILE evaluates to]:FILE:_files' \ |
| 77 |
{-S,--source}'[build the packages source derivations]' \ |
| 78 |
'--sources=[build source derivations]:TYPE:(package all transitive)' \ |
| 79 |
{-s,--system=}'[attempt to build for SYSTEM (e.g. "i686-linux")]:SYSTEM' \ |
| 80 |
'--target=[cross-build for TRIPLET (e.g. "armel-linux-gnu")]:TRIPLET' \ |
| 81 |
{-d,--derivations}'[return the derivation paths of the given packages]' \ |
| 82 |
'--check[rebuild items to check for non-determinism issues]' \ |
| 83 |
'--repair[repair the specified items]' \ |
| 84 |
{-r,--root=}'[make FILE a symlink to the result, and register it as a GC root]:FILE:_files' \ |
| 85 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 86 |
{-q,--quiet}'[do not show the build log]' \ |
| 87 |
'--log-file[return the log file names for the given derivations]' \ |
| 88 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -\' \ |
| 89 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 90 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 91 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 92 |
'--fallback[fall back to building when the substituter fails]' \ |
| 93 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 94 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 95 |
'--no-grafts[do not graft packages]' \ |
| 96 |
'--no-offload[do not attempt to offload builds]' \ |
| 97 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 98 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 99 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 100 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 101 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 102 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 103 |
'--help-transform[list package transformation options not shown here]' \ |
| 104 |
{-V,--version}'[display version information and exit]' \ |
| 105 |
'*:package:->packages' |
| 106 |
|
| 107 |
if [[ "$state" = packages ]]; then |
| 108 |
_guix_list_available_packages |
| 109 |
compadd -a -- _guix_available_packages |
| 110 |
fi |
| 111 |
} |
| 112 |
|
| 113 |
(( $+functions[_guix_challenge] )) || _guix_challenge() |
| 114 |
{ |
| 115 |
_arguments \ |
| 116 |
'--substitute-urls=[compare build results with those at URLS]:URLS:_urls' \ |
| 117 |
'--diff=[show differences according to MODE]:MODE' \ |
| 118 |
{-v,--verbose}'[show details about successful comparisons]' \ |
| 119 |
{-V,--version}'[display version information and exit]' \ |
| 120 |
'*:package:->packages' |
| 121 |
|
| 122 |
if [[ "$state" = packages ]]; then |
| 123 |
_guix_list_available_packages |
| 124 |
compadd -a -- _guix_available_packages |
| 125 |
fi |
| 126 |
} |
| 127 |
|
| 128 |
(( $+functions[_guix_container] )) || _guix_container() |
| 129 |
{ |
| 130 |
_arguments \ |
| 131 |
':action:(exec)' \ |
| 132 |
'*:args' |
| 133 |
} |
| 134 |
|
| 135 |
(( $+functions[_guix_download] )) || _guix_download() |
| 136 |
{ |
| 137 |
_arguments \ |
| 138 |
{-f,--format=}'[write the hash in the given format]:FMT:(nix-base32 base16 base32 hex)' \ |
| 139 |
{-H,--hash=}'[use the given hash ALGORITHM]:ALGORITHM' \ |
| 140 |
'--no-check-certificate[do not validate the certificate of HTTPS servers ]' \ |
| 141 |
{-o,--output=}'[download to FILE]:FILE:_files' \ |
| 142 |
{-V,--version}'[display version information and exit]' \ |
| 143 |
'1:URL:_urls' |
| 144 |
} |
| 145 |
|
| 146 |
(( $+functions[_guix_edit] )) || _guix_edit() |
| 147 |
{ |
| 148 |
_guix_list_available_packages |
| 149 |
compadd -a -- _guix_available_packages |
| 150 |
} |
| 151 |
|
| 152 |
(( $+functions[_guix_environment] )) || _guix_environment() |
| 153 |
{ |
| 154 |
_arguments \ |
| 155 |
{-e,--expression=}'[create environment for the package that EXPR evaluates to]:EXPR' \ |
| 156 |
{-l,--load=}'[create environment for the package that the code within FILE evaluates to]:FILE:_files' \ |
| 157 |
{-m,--manifest=}'[create environment with the manifest from FILE]:FILE:_files' \ |
| 158 |
{-p,--profile=}'[create environment from profile at PATH]:PATH:_files -/' \ |
| 159 |
'--ad-hoc[include all specified packages in the environment instead of only their inputs]' \ |
| 160 |
'--pure[unset existing environment variables]' \ |
| 161 |
{-E,--preserve=}'[preserve environment variables that match REGEXP]:REGEXP' \ |
| 162 |
'--search-paths[display needed environment variable definitions]' \ |
| 163 |
{-s,--system=}'[attempt to build for SYSTEM (e.g. "i686-linux")]:SYSTEM' \ |
| 164 |
{-r,--root=}'[make FILE a symlink to the result, and register it as a GC root]:FILE:_files' \ |
| 165 |
{-C,--container}'[run command within an isolated container]' \ |
| 166 |
{-N,--network}'[allow containers to access the network]' \ |
| 167 |
{-P,--link-profile}'[link environment profile to ~/.guix-profile within an isolated container]' \ |
| 168 |
{-u,--user=}'[instead of copying the name and home of the current user into an isolated container, use the name USER with home directory /home/USER]:USER:_users' \ |
| 169 |
'--no-cwd[do not share current working directory with an isolated container]' \ |
| 170 |
'--share=[for containers, share writable host file system according to SPEC]:SPEC' \ |
| 171 |
'--expose=[for containers, expose read-only host file system according to SPEC]:SPEC' \ |
| 172 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 173 |
'--bootstrap[use bootstrap binaries to build the environment]' \ |
| 174 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 175 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 176 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 177 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 178 |
'--fallback[fall back to building when the substituter fails]' \ |
| 179 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 180 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 181 |
'--no-grafts[do not graft packages]' \ |
| 182 |
'--no-offload[do not attempt to offload builds]' \ |
| 183 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 184 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 185 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 186 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 187 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 188 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 189 |
'--help-transform[list package transformation options not shown here]' \ |
| 190 |
{-V,--version}'[display version information and exit]' \ |
| 191 |
'*:package:->packages' |
| 192 |
|
| 193 |
if [[ "$state" = packages ]]; then |
| 194 |
_guix_list_available_packages |
| 195 |
compadd -a -- _guix_available_packages |
| 196 |
fi |
| 197 |
|
| 198 |
} |
| 199 |
|
| 200 |
(( $+functions[_guix_gc] )) || _guix_gc() |
| 201 |
{ |
| 202 |
_arguments \ |
| 203 |
{-C,--collect-garbage=}'[collect at least MIN bytes of garbage]:MIN' \ |
| 204 |
{-F,--free-space=}'[attempt to reach FREE available space in the store]:FREE' \ |
| 205 |
{-d,--delete-generations=}'[delete profile generations matching PATTERN]:PATTERN' \ |
| 206 |
{-D,--delete}'[attempt to delete PATHS]' \ |
| 207 |
'--list-roots[list the users GC roots]' \ |
| 208 |
'--list-busy[list store items used by running processes]' \ |
| 209 |
'--optimize[optimize the store by deduplicating identical files]' \ |
| 210 |
'--list-dead[list dead paths]' \ |
| 211 |
'--list-live[list live paths]' \ |
| 212 |
'--references[list the references of PATHS]' \ |
| 213 |
{-R,--requisites}'[list the requisites of PATHS]' \ |
| 214 |
'--referrers[list the referrers of PATHS]' \ |
| 215 |
'--derivers[list the derivers of PATHS]' \ |
| 216 |
'--verify=[verify the integrity of the store]:OPTS:(contents repair)' \ |
| 217 |
'--list-failures[list cached build failures]' \ |
| 218 |
'--clear-failures[remove PATHS from the set of cached failures]' \ |
| 219 |
{-V,--version}'[display version information and exit]:V' \ |
| 220 |
'1:PATH:_files -/' |
| 221 |
} |
| 222 |
|
| 223 |
(( $+functions[_guix_graph] )) || _guix_graph() |
| 224 |
{ |
| 225 |
_arguments \ |
| 226 |
{-b,--backend=}'[produce a graph with the given backend TYPE]:TYPE:->types' \ |
| 227 |
'--list-backends[list the available graph backends]' \ |
| 228 |
{-t,--type=}'[represent nodes of the given TYPE]:TYPE:->types' \ |
| 229 |
'--list-types[list the available graph types]' \ |
| 230 |
'--path[display the shortest path between the given nodes]' \ |
| 231 |
{-e,--expression=}'[consider the package EXPR evaluates to]:EXPR' \ |
| 232 |
{-s,--system=}'[consider the graph for SYSTEM (e.g. "i686-linux")]:SYSTEM' \ |
| 233 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 234 |
'--help-transform[list package transformation options not shown here]' \ |
| 235 |
{-V,--version}'[display version information and exit]' \ |
| 236 |
'1:PACKAGE:->packages' |
| 237 |
|
| 238 |
case "$state" in |
| 239 |
types) |
| 240 |
_guix_list_graph_types |
| 241 |
compadd -a -- _guix_graph_types |
| 242 |
;; |
| 243 |
packages) |
| 244 |
_guix_list_available_packages |
| 245 |
compadd -a -- _guix_available_packages |
| 246 |
;; |
| 247 |
esac |
| 248 |
|
| 249 |
} |
| 250 |
|
| 251 |
(( $+functions[_guix_hash] )) || _guix_hash() |
| 252 |
{ |
| 253 |
_arguments \ |
| 254 |
{-x,--exclude-vcs}'[exclude version control directories]' \ |
| 255 |
{-H,--hash=}'[use the given hash ALGORITHM]:ALGORITHM' \ |
| 256 |
{-f,--format=}'[write the hash in the given format]:FMT:(nix-base32 base16 base32 hex)' \ |
| 257 |
{-r,--recursive}'[compute the hash on FILE recursively]' \ |
| 258 |
{-V,--version}'[display version information and exit]' \ |
| 259 |
'1:FILE:_files' |
| 260 |
} |
| 261 |
|
| 262 |
(( $+functions[_guix_import] )) || _guix_import() |
| 263 |
{ |
| 264 |
_arguments \ |
| 265 |
{-V,--version}'[display version information and exit]' \ |
| 266 |
'1:IMPORTER:->importer' \ |
| 267 |
'*:args:' |
| 268 |
|
| 269 |
if [[ "$state" = importer ]]; then |
| 270 |
_guix_list_importers |
| 271 |
compadd -a -- _guix_importers |
| 272 |
fi |
| 273 |
} |
| 274 |
|
| 275 |
(( $+functions[_guix_lint] )) || _guix_lint() |
| 276 |
{ |
| 277 |
_arguments \ |
| 278 |
{-c,--checkers=}'[only run the specified checkers]:CHECKERS:->checkers' \ |
| 279 |
{-x,--exclude=}'[exclude the specified checkers]:CHECKERSS:->checkers' \ |
| 280 |
{-n,--no-network}'[only run checkers that do not access the network]' \ |
| 281 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 282 |
{-l,--list-checkers}'[display the list of available lint checkers]' \ |
| 283 |
{-V,--version}'[display version information and exit]' \ |
| 284 |
'1:PACKAGE:->packages' |
| 285 |
|
| 286 |
case "$state" in |
| 287 |
checkers) |
| 288 |
_guix_list_checkers |
| 289 |
compadd -a -- _guix_checkers |
| 290 |
;; |
| 291 |
packages) |
| 292 |
_guix_list_available_packages |
| 293 |
compadd -a -- _guix_available_packages |
| 294 |
;; |
| 295 |
esac |
| 296 |
} |
| 297 |
|
| 298 |
(( $+functions[_guix_package] )) || _guix_package() |
| 299 |
{ |
| 300 |
_arguments \ |
| 301 |
{-i,--install}'[install one or more packages]: :->install' \ |
| 302 |
{-e,--install-from-expression=}'[install the package EXP evaluates to]:EXP' \ |
| 303 |
{-f,--install-from-file=}'[install the package evaluated from FILE]:FILE:_files' \ |
| 304 |
{-r,--remove}'[remove one or more packages]: :->remove' \ |
| 305 |
{-u,--upgrade=}'[upgrade all the installed packages matching REGEXP]:REGEXP' \ |
| 306 |
{-m,--manifest=}'[create a new profile generation from FILE]:FILE:_files' \ |
| 307 |
'--do-not-upgrade=[do not upgrade any packages matching REGEXP]:REGEXP' \ |
| 308 |
'--roll-back[roll back to the previous generation]' \ |
| 309 |
'--search-paths=[display needed environment variable definitions]:KINDS' \ |
| 310 |
{-l,--list-generations=}'[list generations matching PATTERN]:PATTERN' \ |
| 311 |
{-d,--delete-generations=}'[delete generations matching PATTERN]:PATTERN' \ |
| 312 |
{-S,--switch-generation=}'[switch to a generation matching PATTERN]:PATTERN' \ |
| 313 |
'--export-manifest[print a manifest for the chosen profile]' \ |
| 314 |
'--export-channels[print channels for the chosen profile]' \ |
| 315 |
{-p,--profile}'[use PROFILE instead of the default profile]:PROFILE:_files -/' \ |
| 316 |
'--list-profiles[list the profiles]' \ |
| 317 |
'--allow-collisions[do not treat collisions in the profile as an error]' \ |
| 318 |
'--bootstrap[use the bootstrap Guile to build the profile]' \ |
| 319 |
{-s,--search=}'[search in synopsis and description using REGEXP]:REGEXP' \ |
| 320 |
{-I,--list-installed=}'[list installed packages matching REGEXP]:REGEXP' \ |
| 321 |
{-A,--list-available=}'[list available packages matching REGEXP]:REGEXP' \ |
| 322 |
'--show=[show details about a package]: :->show' \ |
| 323 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 324 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 325 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 326 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 327 |
'--fallback[fall back to building when the substituter fails]' \ |
| 328 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 329 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 330 |
'--no-grafts[do not graft packages]' \ |
| 331 |
'--no-offload[do not attempt to offload builds]' \ |
| 332 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 333 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 334 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 335 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 336 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 337 |
'--debug=[produce debugging output at LEVEL]' \ |
| 338 |
'--help-transform[list package transformation options not shown here]' \ |
| 339 |
{-v,--verbosity=}'[use the given verbosity LEVEL]' \ |
| 340 |
{-V,--version}'[display version information and exit]' |
| 341 |
|
| 342 |
case "$state" in |
| 343 |
install|show) |
| 344 |
_guix_list_available_packages |
| 345 |
compadd -a -- _guix_available_packages |
| 346 |
;; |
| 347 |
remove) |
| 348 |
_guix_list_installed_packages |
| 349 |
compadd -a -- _guix_installed_packages |
| 350 |
;; |
| 351 |
esac |
| 352 |
} |
| 353 |
|
| 354 |
(( $+functions[_guix_install] )) || _guix_install() |
| 355 |
{ |
| 356 |
_arguments \ |
| 357 |
{-p,--profile=}'[use PROFILE instead of the users default profile]:PROFILE:_files -/' \ |
| 358 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 359 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 360 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 361 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 362 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 363 |
'--fallback[fall back to building when the substituter fails]' \ |
| 364 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 365 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 366 |
'--no-grafts[do not graft packages]' \ |
| 367 |
'--no-offload[do not attempt to offload builds]' \ |
| 368 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 369 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 370 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 371 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 372 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 373 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 374 |
'--help-transform[list package transformation options not shown here]' \ |
| 375 |
{-V,--version}'[display version information and exit]' \ |
| 376 |
'*:package:->packages' |
| 377 |
|
| 378 |
if [[ "$state" = packages ]]; then |
| 379 |
_guix_list_available_packages |
| 380 |
compadd -a -- _guix_available_packages |
| 381 |
fi |
| 382 |
} |
| 383 |
|
| 384 |
(( $+functions[_guix_remove] )) || _guix_remove() |
| 385 |
{ |
| 386 |
_arguments \ |
| 387 |
{-p,--profile=}'[use PROFILE instead of the users default profile]:PROFILE:_files -/' \ |
| 388 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 389 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 390 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 391 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 392 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 393 |
'--fallback[fall back to building when the substituter fails]' \ |
| 394 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 395 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 396 |
'--no-grafts[do not graft packages]' \ |
| 397 |
'--no-offload[do not attempt to offload builds]' \ |
| 398 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 399 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 400 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 401 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 402 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 403 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 404 |
{-V,--version}'[display version information and exit]' \ |
| 405 |
'*:package:->packages' |
| 406 |
|
| 407 |
if [[ "$state" = packages ]]; then |
| 408 |
_guix_list_installed_packages |
| 409 |
compadd -a -- _guix_installed_packages |
| 410 |
fi |
| 411 |
} |
| 412 |
|
| 413 |
(( $+functions[_guix_upgrade] )) || _guix_upgrade() |
| 414 |
{ |
| 415 |
_arguments \ |
| 416 |
{-p,--profile=}'[use PROFILE instead of the users default profile]:PROFILE:_files -/' \ |
| 417 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 418 |
'--do-not-upgrade=[do not upgrade any packages matching REGEXP]:REGEXP' \ |
| 419 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 420 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 421 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 422 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 423 |
'--fallback[fall back to building when the substituter fails]' \ |
| 424 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 425 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 426 |
'--no-grafts[do not graft packages]' \ |
| 427 |
'--no-offload[do not attempt to offload builds]' \ |
| 428 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 429 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 430 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 431 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 432 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 433 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 434 |
'--help-transform[list package transformation options not shown here]' \ |
| 435 |
{-V,--version}'[display version information and exit]' \ |
| 436 |
'*:regexp' |
| 437 |
} |
| 438 |
|
| 439 |
(( $+functions[_guix_publish] )) || _guix_publish() |
| 440 |
{ |
| 441 |
_arguments \ |
| 442 |
{-p,--port=}'[listen on PORT]:PORT' \ |
| 443 |
'--listen=[listen on the network interface for HOST]:HOST_hosts' \ |
| 444 |
{-u,--user=}'[change privileges to USER as soon as possible]:USER_users' \ |
| 445 |
{-a,--advertise}'[advertise on the local network]' \ |
| 446 |
{-C,--compression=}'[compress archives with METHOD at LEVEL]:METHOD' \ |
| 447 |
{-c,--cache=}'[cache published items to DIRECTORY]:DIRECTORY:_files -/' \ |
| 448 |
'--cache-bypass-threshold=[serve store items below SIZE even when not cached]:SIZE' \ |
| 449 |
'--workers=[use N workers to bake items]:N' \ |
| 450 |
'--ttl=[announce narinfos can be cached for TTL seconds]:TTL' \ |
| 451 |
'--negative-ttl=[announce missing narinfos can be cached for TTL seconds]:TTL' \ |
| 452 |
'--nar-path=[use PATH as the prefix for nar URLs]:PATH' \ |
| 453 |
'--public-key=[use FILE as the public key for signatures]:FILE:_files' \ |
| 454 |
'--private-key=[use FILE as the private key for signatures]:FILE:_files' \ |
| 455 |
{-r,--repl=}'[spawn REPL server on PORT]:PORT' \ |
| 456 |
{-V,--version}'[display version information and exit]' \ |
| 457 |
} |
| 458 |
|
| 459 |
(( $+functions[_guix_pull] )) || _guix_pull() |
| 460 |
{ |
| 461 |
_arguments \ |
| 462 |
{-C,--channels=}'[deploy the channels defined in FILE]:FILE:_files' \ |
| 463 |
'--url=[download from the Git repository at URL]:URL:_urls' \ |
| 464 |
'--commit=[download the specified COMMIT]:COMMIT' \ |
| 465 |
'--branch=[download the tip of the specified BRANCH]:BRANCH' \ |
| 466 |
'--allow-downgrades[allow downgrades to earlier channel revisions]' \ |
| 467 |
'--disable-authentication[disable channel authentication]' \ |
| 468 |
{-N,--news}'[display news compared to the previous generation]' \ |
| 469 |
{-l,--list-generations=}'[list generations matching PATTERN]:PATTERN' \ |
| 470 |
'--roll-back[roll back to the previous generation]' \ |
| 471 |
{-d,--delete-generations=}'[delete generations matching PATTERN]:PATTERN' \ |
| 472 |
{-S,--switch-generation=}'[switch to a generation matching PATTERN]:PATTERN' \ |
| 473 |
{-p,--profile=}'[use PROFILE instead of ~/.config/guix/current]:PROFILE:_files -/' \ |
| 474 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 475 |
{-s,--system=}'[attempt to build for SYSTEM (e.g. "i686-linux")]:SYSTEM' \ |
| 476 |
'--bootstrap[use the bootstrap Guile to build the new Guix]' \ |
| 477 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 478 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 479 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 480 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 481 |
'--fallback[fall back to building when the substituter fails]' \ |
| 482 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 483 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 484 |
'--no-grafts[do not graft packages]' \ |
| 485 |
'--no-offload[do not attempt to offload builds]' \ |
| 486 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 487 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 488 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 489 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 490 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 491 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 492 |
{-V,--version}'[display version information and exit]' |
| 493 |
} |
| 494 |
|
| 495 |
(( $+functions[_guix_refresh] )) || _guix_refresh() |
| 496 |
{ |
| 497 |
_arguments \ |
| 498 |
{-e,--expression=}'[consider the package EXPR evaluates to]:EXPR' \ |
| 499 |
{-u,--update}'[update source files in place]' \ |
| 500 |
{-s,--select=}'[select all the packages in SUBSET, one of]:SUBSET:(core non-core)' \ |
| 501 |
{-m,--manifest=}'[select all the packages from the manifest in FILE]:FILE:_files' \ |
| 502 |
{-t,--type=}'[restrict to updates from the specified updaters]:UPDATER:-.updaters' \ |
| 503 |
{-L,--list-updaters}'[list available updaters and exit]' \ |
| 504 |
{-l,--list-dependent}'[list top-level dependent packages that would need to be rebuilt as a result of upgrading PACKAGE...]' \ |
| 505 |
{-r,--recursive}'[check the PACKAGE and its inputs for upgrades]' \ |
| 506 |
'--list-transitive[list all the packages that PACKAGE depends on]' \ |
| 507 |
'--keyring=[use FILE as the keyring of upstream OpenPGP keys]:FILE:_files' \ |
| 508 |
'--key-server=[use HOST as the OpenPGP key server]:HOST_hosts' \ |
| 509 |
'--gpg=[use COMMAND as the GnuPG 2.x command]:COMMAND' \ |
| 510 |
'--key-download=[handle missing OpenPGP keys according to POLICY:]:POLICY:(always interactive never)' \ |
| 511 |
'--load-path=[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 512 |
{-V,--version}'[display version information and exit]' \ |
| 513 |
'*:package:->packages' |
| 514 |
|
| 515 |
case "$state" in |
| 516 |
updaters) |
| 517 |
_guix_list_updaters |
| 518 |
compadd -a -- _guix_updaters |
| 519 |
;; |
| 520 |
packages) |
| 521 |
_guix_list_available_packages |
| 522 |
compadd -a -- _guix_available_packages |
| 523 |
;; |
| 524 |
esac |
| 525 |
} |
| 526 |
|
| 527 |
(( $+functions[_guix_size] )) || _guix_size() |
| 528 |
{ |
| 529 |
_arguments \ |
| 530 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 531 |
{-s,--system=}'[consider packages for SYSTEM (e.g. "i686-linux")]:SYSTEM' \ |
| 532 |
'--sort=[sort according to KEY]:KEY:(closure self)' \ |
| 533 |
{-m,--map-file=}'[write to FILE a graphical map of disk usage]:FILE:_files' \ |
| 534 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 535 |
{-V,--version}'[display version information and exit]' \ |
| 536 |
'*:package:->packages' |
| 537 |
|
| 538 |
if [[ "$state" = packages ]]; then |
| 539 |
_guix_list_available_packages |
| 540 |
compadd -a -- _guix_available_packages |
| 541 |
fi |
| 542 |
} |
| 543 |
|
| 544 |
(( $+functions[_guix_system] )) || _guix_system() |
| 545 |
{ |
| 546 |
_arguments \ |
| 547 |
{-L,--load-path=}'[prepend DIR to the package module search path]:DIR:_files -/' \ |
| 548 |
{-K,--keep-failed}'[keep build tree of failed builds]' \ |
| 549 |
{-k,--keep-going}'[keep going when some of the derivations fail]' \ |
| 550 |
{-n,--dry-run}'[do not build the derivations]' \ |
| 551 |
'--fallback[fall back to building when the substituter fails]' \ |
| 552 |
'--no-substitutes[build instead of resorting to pre-built substitutes]' \ |
| 553 |
'--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ |
| 554 |
'--no-grafts[do not graft packages]' \ |
| 555 |
'--no-offload[do not attempt to offload builds]' \ |
| 556 |
'--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ |
| 557 |
'--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ |
| 558 |
'--rounds=[build N times in a row to detect non-determinism]:N' \ |
| 559 |
{-c,--cores=}'[allow the use of up to N CPU cores for the build]:N' \ |
| 560 |
{-M,--max-jobs=}'[allow at most N build jobs]:N' \ |
| 561 |
'--debug=[produce debugging output at LEVEL]:LEVEL' \ |
| 562 |
{-d,--derivation}'[return the derivation of the given system]' \ |
| 563 |
{-e,--expression=}'[consider the operating-system EXPR evaluates to instead of reading FILE, when applicable]:EXPR' \ |
| 564 |
'--allow-downgrades[for reconfigure, allow downgrades to earlier channel revisions]' \ |
| 565 |
'--on-error=[apply STRATEGY when an error occurs while reading FILE]:STRATEGY:(nothing-special backtrace debug)' \ |
| 566 |
'--list-image-types[list available image types]' \ |
| 567 |
{-t,--image-type=}'[for image, produce an image of TYPE]:TYPE' \ |
| 568 |
'--image-size=[for image, produce an image of SIZE]:SIZE' \ |
| 569 |
'--no-bootloader[for init, do not install a bootloader]' \ |
| 570 |
'--volatile[for image, make the root file system volatile]' \ |
| 571 |
'--label=[for image, label disk image with LABEL]:LABEL' \ |
| 572 |
'--save-provenance[save provenance information]' \ |
| 573 |
'--share=[for vm and container, share host file system with read/write access according to SPEC]:SPEC' \ |
| 574 |
'--expose=[for vm and container, expose host file system directory as read-only according to SPEC]:SPEC' \ |
| 575 |
{-N,--network}'[for container, allow containers to access the network]' \ |
| 576 |
{-r,--root=}'[for vm, image, container and build, make FILE a symlink to the result, and register it as a GC root]:FILE:_files' \ |
| 577 |
'--full-boot[for vm, make a full boot sequence]' \ |
| 578 |
'--skip-checks[skip file system and initrd module safety checks]' \ |
| 579 |
'--target=[cross-build for TRIPLET (e.g. "armel-linux-gnu")]:TRIPLET' \ |
| 580 |
{-v,--verbosity=}'[use the given verbosity LEVEL]:LEVEL' \ |
| 581 |
'--graph-backend=[use BACKEND for extension-graphs and shepherd-graph]:BACKEND' \ |
| 582 |
{-V,--version}'[display version information and exit]' \ |
| 583 |
'1:action:->actions' \ |
| 584 |
'*:file:_files' |
| 585 |
|
| 586 |
if [[ "$state" = actions ]]; then |
| 587 |
_guix_list_actions |
| 588 |
compadd -a -- _guix_actions |
| 589 |
fi |
| 590 |
} |
| 591 |
|
| 592 |
(( $+functions[_guix_command] )) || _guix_command() |
| 593 |
{ |
| 594 |
local -a _guix_cmds |
| 595 |
_guix_cmds=( |
| 596 |
"archive:Export/import one or more packages from/to the store" |
| 597 |
"build:Build a given package" |
| 598 |
"challenge:Challenge the substitutes for a package" |
| 599 |
"container:Build and manipulate Linux containers" |
| 600 |
"copy:Copy store items remotely over SSH" |
| 601 |
"deploy:Deploy operating systems on a set of machines" |
| 602 |
"describe:Describe the channel revisions currently used" |
| 603 |
"download:Download the file at given URL and add it to the store" |
| 604 |
"edit:Edit the definitions of a package" |
| 605 |
"environment:Build an environment with a package and its dependencies" |
| 606 |
"gc:Invoke the garbage collector" |
| 607 |
"git:Operate on Git repositories" |
| 608 |
"graph:Emit a DOT representation of the dependencies of a package" |
| 609 |
"hash:Return the cryptographic hash of a file" |
| 610 |
"import:Run an importer" |
| 611 |
"install:Install packages" |
| 612 |
"lint:Run a set of checkers on a package" |
| 613 |
"offload:Set up and operate build offloading" |
| 614 |
"pack:Create application bundles" |
| 615 |
"package:Install, remove, or upgrade packages" |
| 616 |
"processes:List currently running sessions" |
| 617 |
"publish:Publish /gnu/store over HTTP." |
| 618 |
"pull:Download and deploy the latest version of Guix" |
| 619 |
"refresh:Update package definitions to match the latest version" |
| 620 |
"remove:Remove packages" |
| 621 |
"repl:Read-eval-print loop (REPL) for interactive programming" |
| 622 |
"search:Search for packages" |
| 623 |
"show:Show information about packages" |
| 624 |
"size:Report the size of a package and its dependencies" |
| 625 |
"system:Build the operating system" |
| 626 |
"time-machine:Run commands from a different revision" |
| 627 |
"upgrade:Upgrade packages" |
| 628 |
"weather:Report on the availability of pre-built package binaries" |
| 629 |
) |
| 630 |
|
| 631 |
if (( CURRENT == 1 )); then |
| 632 |
_describe -t commands 'guix command' _guix_cmds || compadd "$@" |
| 633 |
else |
| 634 |
local curcontext="$curcontext" |
| 635 |
|
| 636 |
cmd="${${_guix_cmds[(r)$words[1]:*]%%:*}}" |
| 637 |
|
| 638 |
if (( $#cmd )); then |
| 639 |
local cache_policy |
| 640 |
|
| 641 |
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy |
| 642 |
if [[ -z "$cache_policy" ]]; then |
| 643 |
zstyle ":completion:${curcontext}:" cache-policy _guix_caching_policy |
| 644 |
fi |
| 645 |
|
| 646 |
curcontext="${curcontext%:*:*}:guix-${cmd}:" |
| 647 |
|
| 648 |
_call_function ret _guix_${cmd} || _message 'no more arguments' |
| 649 |
else |
| 650 |
_message "unknown guix command: $words[1]" |
| 651 |
fi |
| 652 |
return ret |
| 653 |
fi |
| 654 |
} |
| 655 |
|
| 656 |
_arguments \ |
| 657 |
'(--version)--version[Display version information and exit]' \ |
| 658 |
'*::guix command:_guix_command' |
| 659 |
|
| 660 |
# vim: ts=4 sts=4 sw=4 et ai |
| 661 |
# Local variables: |
| 662 |
# mode: sh |
| 663 |
# End: |