-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
_nix-store
144 lines (134 loc) · 5.2 KB
/
_nix-store
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#compdef nix-store
#autoload
local context state state_descr line
typeset -A opt_args
setopt extendedglob
_nix-common-options
local -a cmd_arguments=(
$__nix_boilerplate_opts
{--realise,-r}'[Build the specified store paths]'
'--serve[provide access to the nix store over stdin/stdout]'
'--gc[Perform garbage collection on the Nix store]'
'--delete[Delete store paths from the Nix store if it is safe to do so]'
{--query,-q}'[Display information about store paths]'
'--add[Add paths to the Nix store]'
'--verify[Verify the consistency of the Nix database and store]'
'--verify-path[Compare the contents of each store path to the hashes stored in the database]'
'--repair-path[Attempt to repair the specified paths by redownloading them]'
'--dump[Produce a NAR file containing the contents of the given path]'
'--restore[Unpack a NAR archive, read from stdin, to the given path]'
'--export[Serialize the specified store paths to stdout in a format which can be imported]'
'--import[Read searialized store paths from stdin and add them to the Nix store]'
'--optimise[Find identical files in the Nix store and hardlink them together to reduce disk usage]'
{--read-log,-l}'[Print the build log of the specified store paths]'
'--dump-db[Dump Nix database to stdout]'
'--load-db[Read a dump of the Nix database]'
'--print-env[Print the environment of a derivation as shell code]'
'--query-failed-paths[Print out store paths which failed to build]'
'--clear-failed-paths[Clear the "failed" state of the given store path]'
'--generate-binary-cache-key[generate an Ed25519 key pair to sign build outputs]:key-name::secret-key-file:_files:public-key-file:_files'
)
# Common nix-store options
local -a common_opts=(
'*:Store Paths:_files'
$__nix_repair
$__nix_common_store_opts
$__nix_common_nixos_rebuild
$__nix_extra_build_opts
)
local -a command_options
local opt
for opt in $words; do
case "$opt" in
--realise|-[^-]#r[^-]#)
command_options=(
$common_opts
$__nix_store_realise_opts
)
break
;;
--serve)
command_options=(
$common_opts
'--write[allow writing to the nix store]'
)
break
;;
--gc)
command_options=(
$common_opts
$__nix_gc_common
'--max-freed[stop the gc after freeing n bytes]:bytes:'
)
break
;;
--delete)
command_options=(
$common_opts
'--ignore-liveness[Ignore reachability from roots]'
)
break
;;
--query|-[^-]#q[^-]#)
command_options+=(
'(--use-output -u)'{--use-output,-u}'[Apply the query to the output path of any store derivations]'
'(--force-realise -f)'{--force-realise,-f}'[Realise each argument to the query first]'
)
local subopt
for subopt in $words; do
case "$subopt" in
--requisites|-R)
command_options+=(
$common_opts
'--include-outputs[Also include the output paths of store derivations]'
)
break
;;
--outputs|--references|--referrers|--referrers-closure|--deriver|-d|--graph|--tree|--binding|-b|--hash|--size|--roots)
command_options+=($common_opts)
break
;;
esac
done
command_options+=(
+ '(query_subcmds)'
'--outputs[Print the output paths of the given store derivations]'
{--requisites,-R}'[Print the closure of the given store paths]'
'--references[Print immediate dependencies of the given store paths]'
'--referrers[Print store paths which refer to these paths]'
'--referrers-closure[Print the closure under the referrers relation]'
'--deriver[Print the deriver of the store paths]'
'--graph[Print the references graph of the store paths in Graphviz format]'
'--tree[Print the references graph of the store paths as an ASCII tree]'
{--binding,-b}'[Print the value of an attribute of the store derivations]:name:'
'--hash[Print the SHA-256 hash of the contents of the store paths]'
'--size[Print the size in bytes of the contents of the store paths]'
'--roots[Print the garbage collector roots that point to the store paths]'
)
break
;;
--verify)
command_options=(
$common_opts
'--check-contents[Compute and validate the SHA-256 hash of each store item]'
)
break
;;
--add|--verify-path|--repair-path|--dump|--restore|--export|--read-log|-l|--print-env)
command_options=($common_opts)
break
;;
--dump-db|--load-db|--query-failed-paths|--optimise)
# nothing to complete
return
;;
--[^-]*|-[^-]#)
# Complete common options if the user has started writing something else
command_options=($common_opts)
;;
esac
done
_arguments -s \
$command_options \
+ '(main_options)' \
$cmd_arguments && return 0