J7MW6ZYFKISU4ZRTEJZWZ5GY42EB2L6O5OSWVNZ2HNXPF4LHVASAC
ZERMM5MUM6JLYFSVV3CXGYPMNAJSUKM265FCZDNZISEUH7XY2SUAC
RXCY7LD6ZRIOIKZEYKLMCYPMQPXF4DOEEFBDLVR2B22BXLZJFFBQC
A3TVGLVHSVLMEHLHB3TPBSD3QGNVGX3DIK6BEBDTTHWBNW4ALMRAC
UIXIJMKKE7STQ65EALHSRFO7J64YCRPRQOQRAX7FJ27455W4X3WAC
IOVPOFAVXEQIZ7BCFVVAWFW3RYFXPK2GOILDWA6N6QHQHLAJ4XTAC
7XDDBWIHI2COD5CEUUTJUPHH24ZYCTZDIMXUXNKZZTUDGMADO6HAC
JTRP2ARQSAGWARGV5IBBXE3QBEAB4HUUXAV6EVOGNCZZAMDWUOSQC
BTKV63XMOYQMYINDWLI6G7MYYJCLRX7UEDH7Y5X5WJVKWO2IZVMQC
5FLRDDUAB7NCOKJKK57IVQBETGX7JTT7GVKFT46ORSZ7OJ7Q2UFQC
BF27BSQ5ZOD342GPS7NDCFRRJ2JPAYAX26TZHGJOV2T5BWW6H75AC
RXWXT4IQ4JGRLN6CAYSDZFKUMNZNAKCATUQBUAYCGIYLVKASU6PAC
LLYVKGN7DJCTBROIXC2RIEKXPEPN2J63F3FPXZRHOXKKXJEAT72AC
NT73J6RN2BBIN2QY3N5VY42BXOLFKWEOYWPX7QGNKTAWWYPJYE4QC
TLDTHX24SHB5LCAPGU2PBXKQWSWTVMVIEPT6TRJKQK3YGOS74JZAC
(comment
(use-package org-brain :ensure t
:init
(setq org-brain-path "~/org-brain/")
:config
(eval-after-load 'evil
'(evil-set-initial-state 'org-brain-visualize-mode 'emacs))
(push '("B" "Brain" plain (function org-brain-goto-end)
"* %i%?" :empty-lines 1)
org-capture-templates)
(setq org-id-track-globally t
org-id-locations-file "~/.emacs.d/.org-id-locations"
org-brain-visualize-default-choices 'all
org-brain-title-max-length 0)))
# Nix Install
alias ni='nix-env -iA'
# Nix Search
alias ns='nix-env -qaP'
function prompt_nix_shell_precmd {
if [[ ${IN_NIX_SHELL} -eq 1 ]] then
if [[ -n ${IN_WHICH_NIX_SHELL} ]] then
NIX_SHELL_NAME=": ${IN_WHICH_NIX_SHELL}"
fi
NIX_PROMPT="%F{8}[%F{3}nix-shell${NIX_SHELL_NAME}%F{8}]%f"
if [[ $PROMPT != *"$NIX_PROMPT"* ]] then
PROMPT="$NIX_PROMPT $PROMPT"
fi
fi
}
function prompt_nix_shell_setup {
autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_nix_shell_precmd
}
prompt_nix_shell_setup "$@"
nix-zsh-completions.plugin.zsh
# Nix Install
alias ni='nix-env -iA'
# Nix Search
alias ns='nix-env -qaP'
function prompt_nix_shell_precmd {
if [[ -n ${IN_NIX_SHELL} && ${IN_NIX_SHELL} != "0" || ${IN_NIX_RUN} && ${IN_NIX_RUN} != "0" ]]; then
if [[ -n ${IN_WHICH_NIX_SHELL} ]] then
NIX_SHELL_NAME=": ${IN_WHICH_NIX_SHELL}"
fi
if [[ -n ${IN_NIX_SHELL} && ${IN_NIX_SHELL} != "0" ]]; then
NAME="nix-shell"
else
NAME="nix-run"
fi
NIX_PROMPT="%F{8}[%F{3}${NAME}${NIX_SHELL_NAME}%F{8}]%f"
if [[ $PROMPT != *"$NIX_PROMPT"* ]] then
PROMPT="$NIX_PROMPT $PROMPT"
fi
fi
}
function prompt_nix_shell_setup {
autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_nix_shell_precmd
}
# Add this to your zshrc if you want the prompt prefixed with `[nix-shell]`
# when you're in a nix-shell environment.
# prompt_nix_shell_setup "$@"
'(- *)'{--hash,--revision}'[Print only the git hash of the channel]'\
'(- *)'{--hash,--revision}'[Show the full SHA1 hash of the Git commit from which this configuration was built.]'\
'--configuration-revision[Show the configuration revision if available.]'\
'--json[Print a JSON representation of the versions of NixOS and the top-level configuration flake.]'
'switch:Build, activate, and update boot default'\
'boot:Build and update boot default without activating'\
'test:Build and activate without updating boot default'\
'build:Build without activating or updating boot default'\
'dry-build:Show what store paths would be built or downloaded without building'\
'dry-activate:Build and show what changes would be performed by the activation'\
'build-vm:Create a script which starts a VM with the built configuration'\
'switch:Build, activate, and update boot default'
'boot:Build and update boot default without activating'
'test:Build and activate without updating boot default'
'build:Build without activating or updating boot default'
'dry-build:Show what store paths would be built or downloaded without building'
'dry-activate:Build and show what changes would be performed by the activation'
'build-vm:Create a script which starts a VM with the built configuration'
#compdef nixos-option
#autoload
_nix-common-options # import _nix_attr_paths etc.
_nixos-option-opts() {
local mods=
if [[ -n "$NIX_PATH" && "$NIX_PATH" =~ "nixos-config=" ]]; then
mods="(import <nixos-config>)"
fi
local options='
with import <nixpkgs/lib>;
(evalModules {
modules = import <nixpkgs/nixos/modules/module-list.nix> ++ [ '"$mods"' ];
}).config
'
_nix_attr_paths $options
}
_arguments \
$__nix_search_path_args \
'--all[Print the values of all options.]' \
':NixOS module options:_nixos-option-opts'
$_nix_search_path_args \
'--root[Treat the given directory as the root of the NixOS installation]:Installation Root:_files -/'\
$__nix_search_path_args \
'--root[Treat the given directory as the root of the NixOS installation]:Installation Root:_path_files -/'\
'--root[Directory to treat as root of filesystem]:Root directory:_files -/'\
'--dir[Directory to write configuration files to (Default /etc/nixos)]:Output directory:_files -/'\
'--root[Directory to treat as root of filesystem]:Root directory:_path_files -/'\
'--dir[Directory to write configuration files to (Default /etc/nixos)]:Output directory:_path_files -/'\
'--auto-start[Start the container immediately]'
'--auto-start[Start the container immediately]'\
'--nixos-path[Path to <nixpkgs/nixos>]:Path:_files'\
'--host-address[Host IP of the veth interface]:host address:'\
'--local-address[IPv4 address assined to the interface in the container]:local address:'\
'--bridge[Put the host-side of the veth-pair into the named bridge]:Bridge interface'\
'--port[Port forwarding]:port forwarding'
local -a _1st_arguments
_1st_arguments=(
{--realise,-r}':Build the specified store paths' \
'--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' \
)
local context state state_descr line
typeset -A opt_args
case "$words[1]" in
--realise|-r)
_arguments \
$_nix_dry_run \
'--ignore-unknown[Silently ignore non-derivation paths with no substitute]' \
'*:Store Paths:_files'
;;
--gc)
_arguments \
$_nix_gc_common \
'--max-freed[Stop garbage collection once this many bytes has been freed]:Bytes:( )'
;;
--delete)
_arguments \
'--ignore-liveness[Ignore reachability from roots]'
;;
--query|-q)
local -a _queries
_queries=(
'--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:Print the value of an attribute of the store derivations' \
'--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' \
)
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'
)
local -a _query_common
_query_common=(
'(--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]' \
)
# 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
)
if (( CURRENT == 2 )); then
_describe -t commands "Query subcommands" _queries
return
fi
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]'
)
case "$words[2]" in
--requisites|-R)
_arguments $_query_common \
'--include-outputs[Also include the output paths of store derivations]' \
'*: :_files'
;;
*)
_arguments $_query_common \
'*: :_files'
;;
esac
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
;;
--verify)
_arguments \
'--check-contents[Compute and validate the SHA-256 hash of each store item]' \
'--repair[Attempt to repair invalid or missing paths by redownloading them]'
;;
--dump-db|--load-db|--query-failed-paths)
# Nothing to complete
;;
*)
_arguments \
'*: :_files'
;;
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)
;;
done
_arguments -s \
$command_options \
+ '(main_options)' \
$cmd_arguments && return 0
local -a _nix_shell_opts
_nix_shell_opts=(
'--command[Run a command instead of starting an interactive shell]:Command:_command_names' \
'--exclude[Do not build any dependencies which match this regex]:Regex:( )' \
'--pure[Clear the environment before starting the interactive shell]' \
'(--packages -p)'{--packages,-p}'[Set up an environment where the given packages are present]:*:Packages: _nix_attr_paths "<nixpkgs>"' \
local -a _nix_shell_opts=(
'--command[Run a command instead of starting an interactive shell]:Command:_command_names'
'--exclude[Do not build any dependencies which match this regex]:Regex:( )'
'--pure[Clear the environment before starting the interactive shell]'
'--run[Run a command in a non-interactive shell instead of starting an interactive shell]:Command:_command_names'
'*'{--attr,-A}"[setup a build shell for package]:package:_nix_complete_attr_paths"
'--type[Use the specified cryptographic hash algorithm]:Hash Algorithm:(md5 sha1 sha256)'\
'1:URL:_urls'\
$__nix_search_path_args \
'--unpack[Unpack tarball/zip first]'\
'--print-path[Print the resulting store path]'\
'--type[Use the specified hash algorithm]:Hash Algorithm:(md5 sha1 sha256 sha512)'\
'--name[Override the resulting nix store filename]:nix store filename:'\
'*'{--attr,-A}'[Fetch the src of derivation (eg. mpv.src)]:src (eg. mpv.src): _nix_complete_attr_paths'\
'1:URL or a local nix file:_resource'\
$_nix_boilerplate_opts \
$_nix_common_opts \
- regular \
$__nix_boilerplate_opts \
$__nix_common_opts \
$__nix_common_store_opts \
$__nix_expr_opts \
'*'{--attr,-A}'[build a .drv from file (default: ./default.nix)]:package:_nix_complete_attr_paths' \
'*:File to instantiate (default\: ./default.nix):_nix_path' \
- find-file \
"--find-file[Look up the given files on Nix's search path]:*:Lookup file using <...> logic:"\
{--install,-i}":Install package"\
{--upgrade,-u}":Upgrade package"\
{--uninstall,-e}":Uninstall package"\
"--set-flag:Modify meta attribute of installed package"\
{--query,-q}":List information about derivations"\
{--switch-profile,-S}":Set the current profile path"\
"--list-generations:Print a list of all generations in the active profile"\
"--delete-generations:Delete specified generations"\
{--switch-generation,-G}":Activate specified generation"\
"--rollback:Switch to the previous generation of active profile"
)
{--install,-i}"[Install package]"
{--upgrade,-u}"[Upgrade package]"
{--uninstall,-e}"[Uninstall package]"
--set-flag'[Modify meta attribute of installed package]:Name:->flag_name:Value:->flag_value:*:Packages: _nix_installed_packages'
{--query,-q}"[List information about derivations]"
{--switch-profile,-S}"[Set the current profile path]"
"--list-generations[Print a list of all generations in the active profile]"
"--delete-generations[Delete specified generations]"
{--switch-generation,-G}"[Activate specified generation]"
"--rollback[Switch to the previous generation of active profile]"
)
local -a _nix_env_common_opts
_nix_env_common_opts=(
$_nix_common_opts \
'(--file -f)'{--file,-f}'[Specify Nix expression used to obtain derivations]:Path to file:_nix_path'\
'(--profile -p)'{--profile,-p}'[Specify the profile to use]:Path:_nix_profiles'\
$_nix_dry_run \
'--system-filter[Only show derivations matching the specified platform]:system:_nix_systems'\
local -a _nix_env_common_opts=(
$__nix_common_opts
'(--profile -p)'{--profile,-p}'[Specify the profile to use]:Path:_nix_profiles'
$__nix_dry_run
'--system-filter[Only show derivations matching the specified platform]:system:_nix_systems'
case "$words[1]" in
--install|-[^-]#i[^-]#)
_arguments -s \
$_nix_env_common_opts \
$_nix_env_b \
$_nix_env_from_profile \
'(--preserve-installed -P)'{--preserve-installed,-P}'[Do not remove derivations with the same name]' \
'(--remove-all -r)'{--remove-all,-r}'[Remove all previously installed packages prior to installing]' \
'*:Package:{if $expect_attr_paths; then _nix_attr_paths ; fi}'\
;;
--upgrade|-[^-]#u[^-]#)
_arguments -s $_nix_env_common_opts \
$_nix_env_b \
$_nix_env_from_profile \
'(-lt -leq -eq --always)--lt[Upgrade derivations with newer versions (default)]' \
'(-lt -leq -eq --always)--leq[Upgrade derivations with the same or newer version]' \
'(-lt -leq -eq --always)--eq[Upgrade derivations with equivalent versions]' \
'(-lt -leq -eq --always)--always[Upgrade even if version number decreases]' \
'*:Packages:_nix_installed_packages'
;;
--uninstall|-[^-]#e[^-]#)
_arguments -s '*::Packages:_nix_installed_packages'
;;
--set-flag)
_set_flag_attrs=(
'priority:Resolve package name conflicts' \
'keep:Prevent package from being upgraded' \
'active:Package is symlinked to profile' \
)
local -a command_options=()
# Look for a main option in the input and setup command_options appropriately
for opt in $words; do
case "$opt" in
--install|-[^-]#i[^-]#)
command_options=(
$_nix_env_common_opts
'(--attr -A)'{--attr,-A}'[Specify packages by attribute path instead of name]'
$_nix_env_b
$_nix_env_from_profile
'(--preserve-installed -P)'{--preserve-installed,-P}'[Do not remove derivations with the same name]'
'(--remove-all -r)'{--remove-all,-r}'[Remove all previously installed packages prior to installing]'
'*:Package:{if $expect_attr_paths; then
_nix_complete_attr_paths;
else
_nix_installed_packages "(use -A/--attr to access all packages)"
fi}')
break
;;
--upgrade|-[^-]#u[^-]#)
command_options=(
$_nix_env_common_opts
$_nix_env_b
$_nix_env_from_profile
'(-lt -leq -eq --always)--lt[Upgrade derivations with newer versions (default)]'
'(-lt -leq -eq --always)--leq[Upgrade derivations with the same or newer version]'
'(-lt -leq -eq --always)--eq[Upgrade derivations with equivalent versions]'
'(-lt -leq -eq --always)--always[Upgrade even if version number decreases]'
'*:Packages: _nix_installed_packages')
break
;;
--uninstall|-[^-]#e[^-]#)
command_options=(
${_nix_env_common_opts:#'(--attr -A)'*}
'*::Packages: _nix_installed_packages')
break
;;
--set-flag)
break
;;
--query|-[^-]#q[^-]#)
command_options=(
$_nix_env_common_opts
'(--available -a)'{--available,-a}'[display all installable derivations]'
$_nix_env_b
'(--status -s)'{--status,-s}'[print status of derivation]'
'(--attr-path -P)'{--attr-path,-P}'[print attribute path of derivations]'
'--no-name[suppress printing of name attribute]'
'(--compare-versions -c)'{--compare-versions,-c}'[compare installed and available version]'
'--system[print system attribute]'
'--drv-path[print store derivation path]'
'--out-path[print output path]'
'--description[print description]'
'--xml[print output as xml]'
'--json[print output as json]'
'--meta[Print all meta attributes: only available with --xml]')
break
;;
--switch-profile|-[^-]#S[^-]#)
command_options=($_nix_env_common_opts ':Profile:_nix_profiles')
break
;;
--delete-generations)
command_options=($_nix_env_common_opts '*::Generations:_nix_generations')
break
;;
--switch-generation|-[^-]#G[^-]#)
command_options=($_nix_env_common_opts '::Generations:_nix_generations')
break
;;
--list-generations)
command_options=($_nix_env_common_opts)
break
;;
--[^-]*|-[^-]#)
# Complete common options if the user has started writing something else
command_options=($_nix_env_common_opts)
;;
esac
done
if (( CURRENT==2 )); then
_describe -t commands "nix-env subcommands" _set_flag_attrs
return
fi
# Let _arguments handle the rest, with _1st_arguments being mutually exclusive
# under the main_options group
_arguments -s $command_options \
'*'{--file,-f}'[Specify Nix expression used to obtain derivations]:Path to file:_nix_path'\
'-f.[evaluate ./default.nix rather than the default]' \
$__nix_boilerplate_opts \
- '(main_options)' \
$_1st_arguments
if (( CURRENT==3 )); then
case "$words[2]" in
# Handle the --set-flag option
case $state in
flag_name)
local -a _set_flag_attrs=(
'priority:Resolve package name conflicts'
'keep:Prevent package from being upgraded'
'active:Package is symlinked to profile'
)
_describe -t commands "Package flag" _set_flag_attrs
break
;;
flag_value)
local flag_name=$words[$(($CURRENT - 1))]
case $flag_name in
else
_nix_installed_packages
fi
;;
--query|-[^-]#q[^-]#)
_arguments -s -O options $_nix_env_common_opts \
'(--available -a)'{--available,-a}'[Display all installable derivations]' \
$_nix_output_opts \
$_nix_env_b \
'(--status -s)'{--status,-s}'[Print status of derivation]' \
'(--attr-path -P)'{--attr-path,-P}'[Print attribute path of derivations]' \
'--no-name[Suppress printing of name attribute]' \
'(--compare-versions -c)'{--compare-versions,-c}'[Compare installed and available version]' \
'--system[Print system attribute]' \
'--drv-path[Print store derivation path]' \
'--out-path[Print output path]' \
'--description[Print description]' \
'--xml[Print output as XML]'\
'--json[Print output as JSON]'\
'--meta[Print all meta attributes: only available with --xml]'\
;;
--switch-profile|-[^-]#S[^-]#)
_arguments ':Profile:_nix_profiles'
;;
--delete-generations)
_arguments \
'*::Generations:_nix_generations'
;;
--switch-generation|-[^-]#G[^-]#)
_arguments '::Generations:_nix_generations'
;;
;;
_path_files '-g' '*.nix(N) *(N-/)'
_alternative \
"file:Local file:_path_files -g '*.nix(N) *(N-/)'" \
'shortcuts:Shortcuts:_nix_shortcuts' \
'channel:Channel:(channel:
channel:nixos-13.10
channel:nixos-14.04 channel:nixos-14.04-small
channel:nixos-14.12 channel:nixos-14.12-small
channel:nixos-15.09 channel:nixos-15.09-small
channel:nixos-16.03 channel:nixos-16.03-small
channel:nixos-16.09 channel:nixos-16.09-small
channel:nixos-17.03 channel:nixos-17.03-small
channel:nixos-17.09 channel:nixos-17.09-small
channel:nixos-18.03 channel:nixos-18.03-small
channel:nixos-18.09 channel:nixos-18.09-small
channel:nixos-19.03 channel:nixos-19.03-small
channel:nixos-19.09 channel:nixos-19.09-small
channel:nixos-20.03 channel:nixos-20.03-small
channel:nixos-20.09 channel:nixos-20.09-small
channel:nixos-21.05 channel:nixos-21.05-small
channel:nixos-21.11 channel:nixos-21.11-small
channel:nixos-22.05 channel:nixos-22.05-small
channel:nixos-22.11 channel:nixos-22.11-small
channel:nixos-unstable channel:nixos-unstable-small
channel:nixpkgs-unstable)' \
'url:URL:(https:// http://)'
} # see: https://channels.nixos.org/
_nix_complete_includes () {
local cur=${words[$CURRENT]}
local -a nixpath=(${(s.:.)NIX_PATH})
local -a path_names
local p
for p in ${nixpath[*]}; do
[[ "$p" == *=* ]] && \
path_names+=(${p%=*}:Path:_nix_complete_dotnix_files)
done
if [[ $cur == *=* ]]; then
path_names+=(${cur%=*}:Path:_nix_complete_dotnix_files)
fi
if [[ "$path_names" ]]; then
_alternative \
"nixpath:nixpath:_values -s = 'Nix path name' $path_names" \
'file:Path:_path_files -/'
else
_path_files -/
fi
return
local generations=($(nix-env --list-generations | awk '{print $1":"$2}'))
_describe "Nix Generations" generations
setopt extendedglob
local -a generations=(${${${(f)"$(nix-env --list-generations)"}## #}/ /:})
_describe -V "Nix Generations" generations
local -a packages
packages=($(nix-env -q | perl -pe 's/-[0-9.-].*$//'))
_values "Nix Packages" $packages
# with the alternative to specify store paths
local extra_help=$1
local prefix='-P ./'
local current_word=$words[$CURRENT]
# When referencing an absolute path we can't prefix with ./
if [[ -z ${current_word:##(/*|\~/*)} && -n $current_word ]]; then
prefix=""
fi
local -a packages=(${${(f)"$(nix-env -q)"}%%-[0-9]*})
_alternative \
"package:packages:_values 'Installed package $extra_help' $packages" \
"file:Store path to package:_files ${prefix}"
local -a result
local -a queue=($1)
local -A result # name -> path map
# Search depth first for directories containing 'default.nix'
# nix-env -iA prioritize the user's channels in case of name collision
# Not sure how collisions in user-created directories are resolved.
local -aU initialQueue=($1/channels $1/channels_root $1/*)
local -a queue=($initialQueue)
# Prints the attribute names (whitespace separated) of the given path
# Arguments: attribute_path [top_level_expr_path]
# top_level_expr is interpreted as 'nix-env --file'
# if top_level_expr is omitted it defaults to what 'nix-env -iA' uses
# Eg. _nix_attr_names nixos.python2Packages mypkgs.nix
_nix_attr_names () {
setopt local_options pipefail
# Complete attribute names using $1 as the toplevel expression NB: If calling
# this function from an action spec you need to prefix it with a space so that
# eg. _arguments won't pass it options which it doesn't expect, ie:
# `: _nix_attr_paths`
_nix_attr_paths () {
local defexpr
if [[ -n $defexpr_path ]]; then
if [[ -e $defexpr_path ]]; then
# If the path exist use the absolute path to make sure import will
# accept it.
# (Otherwise the path is likely a <nixpkgs> notation)
defexpr_path=${defexpr_path:a}
fi
defexpr="import $defexpr_path"
elif [[ $command_name == nix-env ]]; then
defexpr=$(_nix_gen_defexpr ~/.nix-defexpr)
# Starting with '.' causes _sep_parts to complain, so exit early.
# This also guards against error output when completion './files' with nix.
if [[ $cur == .* ]]; then
return
nix-instantiate --eval - \
<<NIX_FILE | tr '[]"' ' '
let
top_gen = $defexpr;
# --file arguments can be a lambda producing a record too
top = if builtins.typeOf top_gen == "lambda" then top_gen {} else top_gen ;
in
builtins.attrNames $attr_path
local defexpr=$1
local attr_path=""
if [[ $cur == *.* ]]; then
attr_path=${cur%.*}
fi
# attr1.attr3 -> ("attr1" "attr2")
local -a paths=(${(s,.,)attr_path})
# Add quotes in a second step to avoid ("") when empty
paths=(${${paths/%/\"}/#/\"})
# Auto call any functions in the attribute path. This isn't a language
# feature, but done by nix when passing attributes on the command line.
local -a result
result=($(_nix_eval_stdin <<NIX_FILE
let
autocall = setOrLambda:
if builtins.isFunction setOrLambda then
setOrLambda {}
else
setOrLambda;
top = autocall ($defexpr);
names = [ ${paths[*]} ];
# Returns attr.name calling it if it's a function
reducer = set: name:
autocall (builtins.getAttr name set);
result = builtins.foldl' reducer top names; #'
in
if builtins.isAttrs result then
builtins.attrNames result
else
""
))
# If the eval failed return the error message
if [[ $? > 0 ]]; then
_message "Eval failed, can't complete (an URL might not be cached):
$result"
return 1
fi
local -a prefix=()
if [[ -n $attr_path ]]; then
for i in ${=attr_path//./ }; do
prefix+=("($i)" .)
done
fi
local package=""
_wanted package package "Attribute path" \
_sep_parts $prefix result \.
return $?
}
function _nix_eval_stdin () {
setopt local_options pipefail
# Build up a modified NIX_PATH using -I and --include
local i override=""
for ((i=1; i < ${#words[*]}; i++)); do
case "${words[i]}" in
-I|--include)
override+=${override:+:}${words[$((i+1))]}
;;
esac
done
override+=${override:+:}${NIX_PATH}
# Resolve channel: syntax
while [[ "$override" == *(=|:)channel:* ]]; do
local channel=${override#*channel:}
channel="channel:"${channel%%:*}
local url="https://nixos.org/channels/"${channel:8}"/nixexprs.tar.xz"
# Replace the channel with its url
override=${override/"$channel"/"$url"}
done
# Resolve any url to a cache, else we might trigger a blocking download
while [[ "$override" == *https://* ]]; do
# Find the first url
local url=${override#*https://}
# Strip everything starting with the first colon
url="https://"${url%%:*}
local cache=$(_nix_resolve_url "$url")
# Replace the url with the cache
override=${override/"$url"/"$cache"}
done
NIX_PATH=$override nix-instantiate --eval - 2>/dev/null | tr '[]"' ' '
# Complete attribute paths
# NB: this function expects an optional argument so the user must make sure
# zsh completion functions doesn't supply arguments. eg. when used in a
# action spec to _arguments the function should be prefixed with a space:
# `: _nix_attr_paths`
# Without the space prefix _arguments will inject lots of arguments. These
# are available(?) in the `expl` array anyway
_nix_attr_paths () {
local attr_path=""
if [[ $words[CURRENT] == *.* ]]; then
attr_path=${words[CURRENT]%.*}
# Generate the top level expression in all the various ways the different
# commands expects it to be built. Then generate completions by calling
# _nix_attr_paths $defexpr
_nix_complete_attr_paths () {
local defexpr=""
local file=$(_nix_get_file_arg)
if [[ "$file" ]]; then
# Extract --arg and --argstr into $args
local i=1 args="" name="" value=""
for ((i=1; i < ${#words[*]}; i++)); do
case "${words[$i]}" in
--arg)
name=${(Q)words[$((i+1))]}
value=${(Q)words[$((i+2))]}
args+="$name = $value;"
i=$((i+2))
;;
--argstr)
name=${(Q)words[$((i+1))]}
value=${(Q)words[$((i+2))]}
args+="$name = \"$value\";"
i=$((i+2))
;;
esac
done
args=${args:+{$args}}
local opt
defexpr="import $file $args"
for opt in $words; do
case $opt in
--expr|-[^-]#E[^-]#)
defexpr="($file) $args"
break
;;
esac
done
else
if [[ $service == nix-env ]]; then
defexpr=$(_nix_gen_defexpr ~/.nix-defexpr)
elif [[ $service == nix ]]; then
# Extract the channels from NIX_PATH and -I/--include
local -a channels=(${(s.:.)NIX_PATH})
# Add -I/--include afterwards, so they will shadow the NIX_PATH
channels+=(${(s.:.)opt_args[-I]})
channels+=(${(s.:.)opt_args[--include]})
# Add the names in an associative array to avoid duplicates
local -A names
local channel name
for channel in $channels; do
name=${channel%%=*}
nix_path=${channel#*=}
if [[ $name != $channel ]]; then
# Only add paths with a name, not sure how they work
names[$name]=1
fi
done
defexpr=$'{ '
for name in ${(@k)names}; do
# nixos-config isn't useful or possible to complete
[[ $name == nixos-config ]] && continue
defexpr+="$name = import <${name}>; "
done
defexpr+=' }'
fi
fi
if [[ $defexpr ]]; then
_nix_attr_paths $defexpr
fi
}
function _nix_resolve_url () {
local url=$1
local version="$($service --version)"
local input
if [[ "${version##* }" == 1.11.* ]]; then
# works for nix 1.11
input="$url"
else
# works for nix 1.12
input="${url##*/}\0$url"
fi
local sha
sha=$(nix-hash --flat --base32 --type sha256 <(printf "$input"))
local cache=${XDG_CACHE_HOME:-~/.cache}/nix/tarballs
local link="$cache"/"$sha"-file
if [[ -e "$link" ]]; then
echo "$cache/$(basename $(readlink $link))-unpacked"
local defexpr_path=$1
if [[ -z $defexpr_path ]]; then
if [[ $command_name == nix-env ]]; then
defexpr_path=$opt_args[-f]
if [[ -z $defexpr_path ]]; then
defexpr_path=$opt_args[--file]
fi
else
if [[ $line ]]; then
defexpr_path=$line[1]
elif [[ -e shell.nix && $command_name == nix-shell ]]; then
defexpr_path=shell.nix
elif [[ -e default.nix ]]; then
defexpr_path=default.nix
fi
fi
function _nix_get_file_arg () {
local file=""
if [[ "$service" == (nix-env|nix) ]]; then
local i
# Extract the last seen -f/--file argument
for ((i=1; i < ${#words[*]}; i++)); do
case "${words[i]}" in
--file|-f)
file=${words[$((i+1))]}
;;
-f\.)
# -f. is accepted shorthand for -f .
file=.
;;
esac
done
elif [[ $line ]]; then
file=$line[1]
elif [[ -e shell.nix && $service == nix-shell ]]; then
file=shell.nix
elif [[ -e default.nix ]]; then
file=default.nix
local -a result # must be on separate line to capture error code..
result=( $(_nix_attr_names "$attr_path" $defexpr_path) ) 2>/dev/null
if [[ "file" ]]; then
# Expand channel: syntax
if [[ "$file" == channel:* ]]; then
file="https://nixos.org/channels/"${file:8}"/nixexprs.tar.xz"
fi
if [[ -e $file ]]; then
# If the path exist use the absolute path to make sure import will
# accept it.
# (Otherwise the path is likely a <nixpkgs> notation)
file=${file:a}
elif [[ "$file" == https://* ]]; then
file=$(_nix_resolve_url $file)
fi
fi
print -n -- $file
}
function _nix_complete_function_arg () {
local file=$(_nix_get_file_arg)
local func=${file:+import $file} opt
local i exclude=""
for ((i=1; i < ${#words}; i++)); do
case "${words[$i]}" in
--expr|-[^-]#E[^-]#)
func="$file"
;;
--arg|--argstr)
# Don't add the name we're currently typing
[[ $i == $((CURRENT - 1)) ]] && continue
exclude+=${exclude:+|}${words[$((i+1))]}
;;
esac
done
if [[ ! $func ]]; then
return
fi
local -a names
names=($(_nix_eval_stdin 2>&1 <<NIX_FILE
if builtins.typeOf ($func) == "lambda" then
builtins.attrNames (builtins.functionArgs ($func))
else
""
NIX_FILE
))
_values -s . "Packages" ${prefix}${^result}
# Either true or false: useful for completing many Nix options
_nix_options_bool () {
_values true false
}
# List gathered from: https://nixos.org/nix/manual/#sec-conf-file
# TODO: Complete the value as well, not just the key
_nix_options () {
# Complete nix options with descriptions
local -a nix_options
# Strip the header line, remove leading spaces and replace separating
# whitespace with ':'
nix_options=(${${${${(f)"$(nix --help-config)"}:1:-1}/# /}/ ##/:})
_describe -t nix_options "Option" nix_options
}
_nix_options_value () {
# Print the description of the option we're setting
local OPTION=$words[$(($CURRENT - 1))]
# Remove lines not starting with " $OPTION " and strip eveything up to the
# last two consecutive spaces
local description=${${${(f)"$(nix --help-config)"}:#^( $OPTION *)}/* /}
local -a values=()
case "$description" in
Whether*)
_values $description true false
;;
*)
_path_files
;;
esac
_nix_profiles () {
local -a profiles
profiles=($(find /nix/var/nix/profiles))
_values "Nix Profiles" $profiles
_nix_run_command_names () {
local cmd chan
if (( ${+commands[sqlite3]} )); then
# Extract the channels from NIX_PATH and -I/--include
# Add -I/--include afterwards, so they will shadow the NIX_PATH
local -a nix_path=(
${(s.:.)NIX_PATH}
${(s.:.)opt_args[-I]}
${(s.:.)opt_args[--include]}
)
# channels: key - channel name, value - path to channel
local -A channels
for chan in $nix_path; do
if [[ $chan = *=* ]]; then
# name=path
channels[${chan%%=*}]=${chan#*=}
else
# path to directory with channels
for chan in $chan/*(-/); do
channels[$chan:t]=$chan
done
fi
done
# pkg_cmds is list of commands inside packages
# This is an associative array to avoid duplicates.
local -A pkg_cmds
for chan in ${(k)channels}; do
# Extract args with prefix "$chan."
local -a pkgs=( "${${(M)words[@]:#"$chan".*}[@]##"$chan".}" )
(( ${#pkgs} )) || continue
local db=${channels[$chan]}/programs.sqlite
[ -f "$db" ] || continue
pkgs=( "'${^pkgs[@]//\'/''}'" ) # SQL-quote
local query="SELECT name FROM programs WHERE package IN (${(j:,:)pkgs})"
for cmd in $(sqlite3 "$db" "$query"); do
pkg_cmds[$cmd]=
done
done
compadd -X 'Package commands' -- ${(k)pkg_cmds}
fi
_command_names -e -X 'All commands'
_nix_gc_common=(
'(- --print* --delete)--print-roots[Print roots used by garbage collector]' \
'(- --print* --delete)--print-live[Print store paths reachable from roots]' \
'(- --print* --delete)--print-dead[Print store paths not reachable from roots]' \
'(- --print* --delete)--delete[Garbage collect all dead paths from the store]' \
__nix_gc_common=(
'(- --print* --delete)--print-roots[Print roots used by garbage collector]'
'(- --print* --delete)--print-live[Print store paths reachable from roots]'
'(- --print* --delete)--print-dead[Print store paths not reachable from roots]'
'(- --print* --delete)--delete[Garbage collect all dead paths from the store]'
_nix_search_path_args=(
'*-I+[Add path to Nix expression search path]:Include path:_nix_complete_dotnix_files'\
__nix_search_path_args=(
'*-I[add a path to the list of locations used to look up <...> file names]:include path:_nix_complete_includes'
# Either true or false: useful for completing many Nix options
_nix_options_bool () {
_values true false
}
# List gathered from: https://nixos.org/nix/manual/#sec-conf-file
# TODO: Complete the value as well, not just the key
_nix_options () {
_values \
'gc-keep-outputs' \
'gc-keep-derivations' \
'env-keep-derivations' \
'build-max-jobs' \
'build-cores' \
'build-max-silent-time' \
'build-timeout' \
'build-max-log-size' \
'build-users-group' \
'build-use-chroot' \
'build-chroot-dirs' \
'build-extra-chroot-dirs' \
'build-use-substitutes' \
'build-fallback' \
'build-cache-failure' \
'build-keep-log' \
'build-compress-log' \
'use-binary-caches' \
'binary-caches' \
'binary-caches-files' \
'trusted-binary-caches' \
'extra-binary-caches' \
'signed-binary-caches' \
'binary-cache-public-keys' \
'binary-caches-parallel-connections' \
'verify-https-binary-caches' \
'force-manifest' \
'system' \
'fsync-metadata' \
'auto-optimise-store' \
'connect-timeout' \
'log-servers' \
'trusted-users' \
'allowed-users' \
'restrict-eval' \
'pre-build-hook'
}
__nix_repair='--repair[Fix corrupted or missing store paths by redownloading or rebuilding]';
_nix_common_nixos_rebuild=(
'(--verbose -v)*'{--verbose,-v}'[Increase verbosity of diagnostic messages]'\
'(--no-build-output -Q)'{--no-build-output,-Q}'[Silence output to stdout and stderr]'\
'(--max-jobs -j)'{--max-jobs,-j}'[Set the maximum number of build jobs that Nix will perform in parallel]'\
'--cores[Set the parallelism of the individual builders (e.g. -j argument to make)]'\
'(--keep-going -k)'{--keep-going,-k}'[Keep going in case of failed builds, to the greatest extent possible]'\
'(--keep-failed -K)'{--keep-failed,-K}'[Do not delete the build directory if build fails]'\
'--fallback[If binary download fails, fall back on building from source]'\
'--show-trace[Print stack trace of evaluation errors]'\
'--option[Set Nix configuration option]:Options:_nix_options:Value:( )'\
$_nix_repair
)
__nix_common_nixos_rebuild=(
$__nix_search_path_args
$__nix_repair
'(--verbose -v)*'{--verbose,-v}'[Increase verbosity of diagnostic messages]'
'(--no-build-output -Q)'{--no-build-output,-Q}'[silence output to stdout and stderr]'
'(--max-jobs -j)'{--max-jobs,-j}'[max number of build jobs in parallel]:jobs:'
'--cores[threads per job (e.g. -j argument to make)]:cores:'
'(--keep-going -k)'{--keep-going,-k}"[keep going until all builds are finished]"
'(--keep-failed -K)'{--keep-failed,-K}'[keep failed builds (usually in /tmp)]'
'--fallback[If binary download fails, fall back on building from source]'
'--show-trace[Print stack trace of evaluation errors]'
'*--option[set Nix configuration option]:options:_nix_options:value:_nix_options_value'
)
__nix_common_nixos_build_vms=(
'*--option[set Nix configuration option]:options:_nix_options:value:_nix_options_value'
)
__nix_common_store_opts=(
'--add-root[register result as a root of the garbage collector]:path (Hint /nix/var/nix/gcroots):_path_files -/'
'--indirect[store gc root outside GC roots directory]'
)
# Used in: nix-build, nix-env, nix-instantiate, nix-shell and nix-store
__nix_extra_build_opts=(
'--max-silent-time[max seconds without getting stdout/err from builder]:Seconds:'
'--timeout[max seconds builders should run]:seconds:'
'--readonly-mode[do not open Nix database]'
'--log-format[configure how output is formatted]:output format:((pretty\:"Default" escapes\:"Indicate nesting with escape codes" flat\:"Remove all nesting"))'
)
_nix_common_opts=(
$_nix_common_nixos_rebuild \
$_nix_search_path_args \
'(--attr -A)'{--attr,-A}'[Select an attribute from the top-level Nix expression being evaluated]:Packages: _nix_attr_paths'\
'(--expr -E)'{--expr,-E}'[Interpret command line args as Nix expressions]:*:Files:_files'\
'*--arg[Argument to pass to the Nix function]:Name:( ):Value:( )'\
'--argstr[Like --arg, but the value is a string]: :'\
'--max-silent-time[Builder times out after not producing stdout/stderr for x seconds]:Seconds:( )'\
'--timeout[Timeout builder after given number of seconds]:Seconds:( )'\
'--readonly-mode[Do not open Nix database]'\
'--log-type[Configure how output is formatted]:Output format:((pretty\:"Default" escapes\:"Indicate nesting with escape codes" flat\:"Remove all nesting"))'\
__nix_common_opts=(
$__nix_common_nixos_rebuild
$__nix_args_opts
$__nix_extra_build_opts
'*--include[add a path to the list of locations used to look up <...> file names]:include path:_nix_complete_includes'
'*--arg[argument to pass to the Nix function]:Name:_nix_complete_function_arg:Value: '
'*--argstr[pass a string]:Name:_nix_complete_function_arg:String: '
)
# Options for nix-store --realise, used by nix-build
__nix_store_realise_opts=(
$__nix_dry_run
'--check[rebuild and see if output is deterministic]'
case $state in
nix-channels)
local -a channels=(${${(f)"$(nix-channel --list)"}%% *})
_values 'Nix Channels' ${channels}
esac
local -a _nix_build_opts
_nix_build_opts=(
'--drv-link[Add a symlink to the store derivation]:Symlink Name:( )' \
'--add-drv-link[Shorthand for --drv-link ./derivation]' \
'--no-out-link[Do not create a symlink to the output path]' \
{--out-link,-o}'[Name of the output symlink]:Output Symlink Name:( )' \
local -a _nix_build_opts=(
$__nix_expr_opts
$__nix_common_store_opts
'*'{--attr,-A}'[build a package from file (default: ./default.nix)]:package:_nix_complete_attr_paths'
--check'[Rebuild derivation]'
'--drv-link[Add a symlink to the store derivation]:Symlink Name:( )'
'--add-drv-link[Shorthand for --drv-link ./derivation]'
'--no-out-link[Do not create a symlink to the output path]'
{--out-link,-o}'[Name of the output symlink]:Output Symlink Name:( )'
Set `programs.zsh.enableCompletion = true` in `/etc/nix/configuration.nix` and either add `nix-zsh-completions` to `systemPackages` or install it locally: `nix-env -iA nixos.nix-zsh-completions`
Setting `programs.zsh.enable = true` in `/etc/nixos/configuration.nix` will automatically install and enable `nix-zsh-compeletions`.
<!--
Thank you for reporting an issue :) broken software is no fun for anyone :(
To quickly figure out any problem there's some information that's often useful.
Namely your system and a step by step explanation on how to reproduce the
problem (or a completion trace if reproduction isn't clear)
If the issue is a feature request or doesn't require this information you can
omit it, deleting the `System` and `Completion trace` headers
Lines wrapped with \<!-- ... --\> will be ignored, so you don't have to delete them.
-->
### Description
### Reproduction steps
<!--
Steps to reproduce the problem
-->
### System
- nix-zsh-completions version: <!-- version or git commit -->
- ZSH version: <!-- print $ZSH_VERSION -->
- NIX_PATH: <!-- print $NIX_PATH -->
<!--
also run `nix-shell -p nix-info --run "nix-info -m"` and paste the result here
-->
### Completion trace
<!--
If the issue is elusive and you're unable to reproduce it conistently a completion trace of the failure can be useful.
To produce a trace do this:
Use the `Ctr-x ?` keybinding instead of tab (at the place tab fails).
This will give you a file in `/tmp` with a full trace.
Post the file to a gist service and include the link here.
-->
# Nix Install
alias ni='nix-env -iA'
# Nix Search
alias ns='nix-env -qaP'
function prompt_nix_shell_precmd {
if [[ -n ${IN_NIX_SHELL} && ${IN_NIX_SHELL} != "0" || ${IN_NIX_RUN} && ${IN_NIX_RUN} != "0" ]]; then
if [[ -n ${IN_WHICH_NIX_SHELL} ]] then
NIX_SHELL_NAME=": ${IN_WHICH_NIX_SHELL}"
fi
if [[ -n ${IN_NIX_SHELL} && ${IN_NIX_SHELL} != "0" ]]; then
NAME="nix-shell"
else
NAME="nix-run"
fi
NIX_PROMPT="%F{8}[%F{3}${NAME}${NIX_SHELL_NAME}%F{8}]%f"
if [[ $PROMPT != *"$NIX_PROMPT"* ]] then
PROMPT="$NIX_PROMPT $PROMPT"
fi
fi
}
function prompt_nix_shell_setup {
autoload -Uz add-zsh-hook
add-zsh-hook precmd prompt_nix_shell_precmd
}
# Add this to your zshrc if you want the prompt prefixed with `[nix-shell]`
# when you're in a nix-shell environment.
# prompt_nix_shell_setup "$@"
#compdef nixos-option
#autoload
_nix-common-options # import _nix_attr_paths etc.
_nixos-option-opts() {
local mods=
if [[ -n "$NIX_PATH" && "$NIX_PATH" =~ "nixos-config=" ]]; then
mods="(import <nixos-config>)"
fi
local options='
with import <nixpkgs/lib>;
(evalModules {
modules = import <nixpkgs/nixos/modules/module-list.nix> ++ [ '"$mods"' ];
}).config
'
_nix_attr_paths $options
}
_arguments \
$__nix_search_path_args \
'--all[Print the values of all options.]' \
':NixOS module options:_nixos-option-opts'
<!--
Thank you for reporting an issue :) broken software is no fun for anyone :(
To quickly figure out any problem there's some information that's often useful.
Namely your system and a step by step explanation on how to reproduce the
problem (or a completion trace if reproduction isn't clear)
If the issue is a feature request or doesn't require this information you can
omit it, deleting the `System` and `Completion trace` headers
Lines wrapped with \<!-- ... --\> will be ignored, so you don't have to delete them.
-->
### Description
### Reproduction steps
<!--
Steps to reproduce the problem
-->
### System
- nix-zsh-completions version: <!-- version or git commit -->
- ZSH version: <!-- print $ZSH_VERSION -->
- NIX_PATH: <!-- print $NIX_PATH -->
<!--
also run `nix-shell -p nix-info --run "nix-info -m"` and paste the result here
-->
### Completion trace
<!--
If the issue is elusive and you're unable to reproduce it conistently a completion trace of the failure can be useful.
To produce a trace do this:
Use the `Ctr-x ?` keybinding instead of tab (at the place tab fails).
This will give you a file in `/tmp` with a full trace.
Post the file to a gist service and include the link here.
-->