What's the "nix way" of bash completion for packages?

I’m using neovim (nvim) and seeing shell completion doesn’t exist (in bash, try: nvim -[tab] and nothing happens). How do I neovim’s completion scripts sourced? Sorry I couldn’t find this answered before!

I’m new to nixos and struggling to understand where any given package’s shell completions live, so I welcome a more general answer too.


to this broader point: I’m hitting this with yet another command: gradle; I have gradle-completion installed via configuration.nix but no completion seems to be happening. I’m trying to debug… I see that Package gradle-completion on Nix shows there should be something under an “out” dir at /share/bash-completion/completions/gradle - but where is that out dir? And should it already be sourced by something for me or do I need nixos specific sourcing logic in my bashrc?

I found and installed bashInteractive, bash-completion, nix-bash-completions but still no changes and I’m not clear on if bashInteractive is really supposed to be solving anything I’m confused about here…

Bash completions are enabled with the programs.bash.enableCompletion option. It should be enabled by default. You can see the implementation if you click the source link on the search page - it disables completions in bash versions that don’t support it. Maybe get rid of the additional bash packages, just in case :wink:

Is your shell running in interactive mode? You won’t get completions if you run a non-interactive shell. Doing some funky things with your bash configuration may also break them, I’d suggest trying this with no configuration first. Try:

bash --norc -i

The way packages work in NixOS is that they’re all installed in their own independent directories under /nix/store. Various parts of NixOS will look at the subdirectories in their package directories, and do things with them - bin directories in packages are added to your PATH, and indeed, completion scripts in that subdirectory should be automatically found by bash.

I’ve found this to work for me more often than with other distros :slight_smile: If you can’t figure it out, share your config (including bash config), maybe someone here can spot it.

The fact that nix packages work this way means you can have multiple versions of the same package installed, in theory without interference (but well, running two graphics drivers is impossible due to physical limitations, to run two versions of Xorg you need at least two ttys… It works well for things like python, though).

1 Like

tl;dr still no luck even with --norc -i; maybe understanding how it usually works correctly in nixos will give me something to debug :confused: Couple questions below…

Can you clarify which packages you’re saying I might try to get rid of? Comment out all the bash* ones except bash itself in my system packages?

Is your shell running in interactive mode?

Yes, otherwise most of the output from my own bashrc wouldn’t run (since [[ ${-} = ${-/i/} ]] && return has been the first line of my bashrc for years).

Doing some funky things with your bash configuration may also break them, I’d suggest trying this with no configuration first. Try: bash --norc -i

Oh good idea - I definitely have some highly customized bashrc. Unfortunately this^ test with --norc didn’t change anything. To clarify here’s a list of programs I’m using in my “does completion work yet?”-test:

  • less
  • nvim
  • gradle (particularly since I have gradle and gradle-completion packages)

Can you confirm these^ work for you? (or if you have none of htem installed - is there a program you do have that I can use as my litmus test?) Just asking in case there’s actually just something wonky or custom about my selections.

and indeed, completion scripts in that subdirectory should be automatically found by bash.

So the exact mechanics of this - “should be automatically found by bash” - is what I’d like to learn. There must be some standard very specific to nixos that makes it so things “should” work across packages - do you know what that standard is?

I’ve found this to work for me more often than with other distros :slight_smile:

haha, fwiw this statement is super valuable - it at least tells me something is just wonky on my end and it’s fixable. My understanding of why this always works for me on Debian is:

  1. package provides a program named $program-name, eg: say nvim (provided by the neovim package)
  2. package installation installs its completion script in a common directory, specifically here: /usr/share/bash-completion/completions/$program-name
  3. your bashrc (or system’s bashrc) loops over every top-level file in /usr/share/bash-completion/completions/ and sources it.

With nixos however, I don’t know what the analog expectation is - understanding how nixos does it might give me a first-step in debugging my install. The only concrete thing I’ve gotten completion for is a very hand-done step end-users have to do for fzf (sourcing a very app-specific way with this fzf-share hack: fzf - NixOS Wiki)

Just guessing you meant this snippet from me:

So I left only bash in my system package listing and now less actually autocompletes :smiley: but nothing else in my litmus test does :sob: … hopefully helpful debugging signal.

1 Like

I’m not familiar enough with the completion stuff to know if this is meaningful, but I assume they have to get sourced somewhere in the chain, so one possibility–if you’ve customized any of your other ~bashrc/profile stuff–might be that a statement in those is returning early and keeping the completions from getting sourced?

1 Like

thanks abathur. I think this was TLATER’s idea when suggesting bash --norc -i (the --norc ensures my own bashrc doesn’t even run - so I don’t even need to go putting an early return at the top, because it won’t be used).

This has me thinking though: could it be more than bashrc? My understanding is that my ~/.bashrc is the only entry point, but it’s possible that there’s another config file somewhere in my ecosystem that’s causing an issue? :thinking:

… As a clean-slate, let me go boot into the 22.05 gnome Live ISO and see what happens…

So to confirm this I spun up one of my servers’ configs in a VM built using nixos-rebuild build-vm. It has a very minimal config for my user (basically only giving them wheel permissions) and no bash or other interactive configuration - it’s a headless server :wink:

Trying with less -<tab><tab><tab> (the dash so it doesn’t just complete files) completes for me.

I don’t have gradle installed by default, but using nix profile install nixpkgs#gradle nixpkgs#gradle-completion (note: I don’t recommend using nix profile or nix-env when you’re not in an experimental VM environment, and don’t exactly know the implications of installing things nondeclaratively in your profile) to install it, I get completions for options if I use gradle -<tab><tab><tab>.

I don’t get completions for nvim, but I don’t think that package has completions set up: https://github.com/NixOS/nixpkgs/blob/316b762afdb9e142a803f29c49a88b4a47db80ee/pkgs/applications/editors/neovim/default.nix. If you know they exist for neovim, and you really want them, I’d suggest contributing.

Other commands where this works for me:

  • nixos-rebuild
  • firefox
  • bash

I think I am reasonably confident now that I wasn’t lying, and this is supposed to just work™. But hey, I’ve seen often enough that even NixOS doesn’t always save us from the frailty of software.

Pretty much. But yes, there is still /etc/bashrc, and all the other config that is probably created via your NixOS configuration. Can you usefully share your config?

I’d seen a nice summary of how the completion works before, but can’t find it anymore. I’ll see if I can dig it up some other time!

1 Like

Ah. Caught me not reading the whole backlog. Not sure. I know there’s a profile, and the corresponding --no-profile flag, but there’s some sort of complexity around their use and the login/interactive shell bits on macOS and Linux that I can never keep straight…

Using --no-profile will completely disable these completions as well, sadly. It gets a lot harder if it’s an issue outside of --norc.

1 Like

You might also be able to use bash -x to and trawl through the vomit to see if it’s getting to the completions or where it’s stopping?

1 Like

From /etc/bashrc

# Check whether we're running a version of Bash that has support for
# programmable completion. If we do, enable all modules installed in
# the system and user profile in obsolete /etc/bash_completion.d/
# directories. Bash loads completions in all
# $XDG_DATA_DIRS/bash-completion/completions/
# on demand, so they do not need to be sourced here.
if shopt -q progcomp &>/dev/null; then
  . "/nix/store/bcjj9j8xqbwqx4fcsxydya671pgl5nzq-bash-completion-2.11/etc/profile.d/bash_completion.sh"
  nullglobStatus=$(shopt -p nullglob)
  shopt -s nullglob
  for p in $NIX_PROFILES; do
    for m in "$p/etc/bash_completion.d/"*; do
      . "$m"
  eval "$nullglobStatus"
  unset nullglobStatus p m

So nix package completions will happen automatically by the package adding itself to $XDG_DATA_DIRS with its completions in its bash-completion/completions/ dir. (I’ve not actually confirmed this happens; but I trust the comment. Completions work for me.)


progcomp wouldn’t be true in the non-interactive bash, I think, but it sounded like that thread got pulled earlier. set -x should make it clear if that step is falling over or never happening, I imagine.

I felt guilty, so I confirmed it works as described. To do that I

echo $XDG_DATA_DIRS # notice it contains `/run/current-system/sw/share`
ls -al /run/current-system/sw/share/bash-completion/completions/nix
# responds `/nix/store/rrgcc6kzvx9d85b448jga7sdv0z2fzmr-nix-2.9.1/share/bash-completion/completions/nix` or similar

Explore the package dirs /nix/store/rrgcc6kzvx9d85b448jga7sdv0z2fzmr-nix-2.9.1/.

Okay for posterity, here’s the complete listing I just got from a live boot:

long list of `complete` output here
# command run on 2022-07-08 on a gnome live iso for nixos 22.05
$ complete | sort
complete -A helptopic help
complete -A setopt set
complete -A shopt shopt
complete -A stopped -P '"%' -S '"' bg
complete -a unalias
complete -b builtin
complete -c type
complete -c which
complete -F _command aoss
complete -F _command command
complete -F _command do
complete -F _command else
complete -F _command eval
complete -F _command exec
complete -F _command ltrace
complete -F _command nice
complete -F _command nohup
complete -F _command padsp
complete -F _command then
complete -F _command time
complete -F _command tsocks
complete -F _command vsound
complete -F _command xargs
complete -F _completion_loader -D
complete -F _filedir_xspec vim
complete -F _firefox firefox
complete -F _firefox iceweasel
complete -F _firefox mozilla-firefox
complete -F _known_hosts dig
complete -F _known_hosts fping
complete -F _known_hosts fping6
complete -F _known_hosts ftp
complete -F _known_hosts mtr
complete -F _known_hosts rlogin
complete -F _known_hosts rsh
complete -F _known_hosts showmount
complete -F _known_hosts ssh-installkeys
complete -F _known_hosts telnet
complete -F _known_hosts traceroute
complete -F _known_hosts traceroute6
complete -F _longopt a2ps
complete -F _longopt awk
complete -F _longopt base64
complete -F _longopt bash
complete -F _longopt bc
complete -F _longopt bison
complete -F _longopt cat
complete -F _longopt chroot
complete -F _longopt colordiff
complete -F _longopt cp
complete -F _longopt csplit
complete -F _longopt cut
complete -F _longopt date
complete -F _longopt df
complete -F _longopt diff
complete -F _longopt dir
complete -F _longopt du
complete -F _longopt enscript
complete -F _longopt env
complete -F _longopt expand
complete -F _longopt fmt
complete -F _longopt fold
complete -F _longopt gperf
complete -F _longopt grep
complete -F _longopt grub
complete -F _longopt head
complete -F _longopt irb
complete -F _longopt ld
complete -F _longopt ldd
complete -F _longopt less
complete -F _longopt ln
complete -F _longopt ls
complete -F _longopt m4
complete -F _longopt md5sum
complete -F _longopt mkdir
complete -F _longopt mkfifo
complete -F _longopt mknod
complete -F _longopt mv
complete -F _longopt netstat
complete -F _longopt nl
complete -F _longopt nm
complete -F _longopt objcopy
complete -F _longopt objdump
complete -F _longopt od
complete -F _longopt paste
complete -F _longopt pr
complete -F _longopt ptx
complete -F _longopt readelf
complete -F _longopt rm
complete -F _longopt rmdir
complete -F _longopt sed
complete -F _longopt seq
complete -F _longopt sha1sum
complete -F _longopt sha224sum
complete -F _longopt sha256sum
complete -F _longopt sha384sum
complete -F _longopt sha512sum
complete -F _longopt shar
complete -F _longopt shasum
complete -F _longopt sort
complete -F _longopt split
complete -F _longopt strip
complete -F _longopt sum
complete -F _longopt tac
complete -F _longopt tail
complete -F _longopt tee
complete -F _longopt texindex
complete -F _longopt touch
complete -F _longopt tr
complete -F _longopt uname
complete -F _longopt unexpand
complete -F _longopt uniq
complete -F _longopt units
complete -F _longopt vdir
complete -F _longopt wc
complete -F _longopt who
complete -F _minimal ''
complete -F _root_command fakeroot
complete -F _root_command gksu
complete -F _root_command gksudo
complete -F _root_command kdesudo
complete -F _root_command really
complete -F _service service
complete -F _user_at_host finger
complete -F _user_at_host talk
complete -F _user_at_host ytalk
complete -j -P '"%' -S '"' disown
complete -j -P '"%' -S '"' fg
complete -j -P '"%' -S '"' jobs
complete -o filenames -F _grub_editenv grub-editenv
complete -o filenames -F _grub_install grub-install
complete -o filenames -F _grub_mkconfig grub-mkconfig
complete -o filenames -F _grub_mkfont grub-mkfont
complete -o filenames -F _grub_mkimage grub-mkimage
complete -o filenames -F _grub_mkpasswd_pbkdf2 grub-mkpasswd-pbkdf2
complete -o filenames -F _grub_mkrescue grub-mkrescue
complete -o filenames -F _grub_probe grub-probe
complete -o filenames -F _grub_script_check grub-script-check
complete -o filenames -F _grub_set_entry grub-reboot
complete -o filenames -F _grub_set_entry grub-set-default
complete -o filenames -F _grub_setup grub-bios-setup
complete -o filenames -F _grub_setup grub-sparc64-setup
complete -o nospace -F _cd cd
complete -o nospace -F _cd pushd
complete -u groups
complete -u slay
complete -u sux
complete -u w
complete -v readonly
complete -v unset

I’m surprised how a lot of stuff is just bash’s own _longopt man-page-scraping hack.

I’m going to go poke at my Debian machine and see what other programs are completed differently. I mean … something must be different because I started this rabbit hole of thinking about completion quality because I was trying on nixos… I can’t remember the last time I cared about (or learned so much about) completion :laughing: :man_facepalming:

I’ll reply to some of the other comments in a bit (thanks everyone)… just wanted to share this tiny bit of progress.

whoa, thanks a lot for finding this! this is very much a mystery I wanted to solve. I unfortunately never thought to read the system-rc scripts because I somehow had the notion they’re be skipped if a user’s own rc is defined. (I think I just assumed it was “magic, elsewhere” that was giving default behaviors :man_facepalming:)

tl;dr I’m more convinced that I was just confused and maybe nothing’s broken; will get back about comparing with my non-nixos machine to see if there’s anything interesting to share+learn there.

Okay so I’ve learned some things worth sharing… at least for future-me:

  1. my gradle completion is working (I don’t know why it didn’t work on my previous test).
  2. some things I thought were broken were just fzf’s over-zelous completion script (complete -p less outputs fzf function now instead of _longopts; it seemed broken because fzf’s func only completes filenames now so CLI flags that _longopts revealed have disappeared).
  3. there’s a lot of completion scripts installed by nix packages in the places @ericgundrum revealed. See script and sample outputs below. This was quite interesting to me.

Thanks for sticking with me TLATER (and everyone) despite my tail-chasing :slight_smile: - I’ve learned a bunch.

inspecting installed completions

Following up on ericgundrum’s hint, here’s some interesting output show that a lot of packages indeed reveal their completion sources via $XDG_DATA_DIRS's subpaths.

quick forloop to inspect with

here's a tiny script that searches the $XDG_DATA_DIRS and $NIX_PROFILES subpaths
#!/usr/bin/env bash

function listColonDelimitedMembers() { echo "$1" | sed --expression 's,:,\n,g'; }

# per helpful comment here:
#   https://discourse.nixos.org/t/whats-the-nix-way-of-bash-completion-for-packages/20209/12
# Lists all paths existing system-wide Bash scripts (at least on nixos) will
# look for bash-completion scripts (and _source_ those scripts) before user's
# settings are invoked.
function listPotentialCompletionPaths() {
  # use printf-overloading atop bash's word-splitting
  printf 'NIX_PROFILES %s/etc/bash_completion.d\n' $NIX_PROFILES

  # These paths _maybe_ even applicable outside nixos.
  listColonDelimitedMembers "$XDG_DATA_DIRS" |
    sed --regexp-extended \
        --expression 's,^,XDG_DATA_DIRS ,' \
        --expression 's,/?$,/bash-completion/completions,g'

while read src dir; do
  if [[ ! -e "$dir" ]]; then
    # printf 'SKIPPING $%s-entry:\t%s\n\n'  "$src" "$dir"

  printf 'LISTING extant $%s-dir:\t%s\n\t\t%s\n' \
    "$src" "$dir" "$(readlink --canonicalize "$dir")"

  find -L "$dir" -mindepth 1 -maxdepth 1 -type f -printf '%P\n' |
    sort |

done < <(listPotentialCompletionPaths | sort | uniq)

baseline (ISO) completions

here's the output I see on a live iso
# 2022-07-09 forloop over $XDG_DATA_DIRS and $NIX_PROFILES paths on
# a fresh nixos 22.05 install via calamares with no further system modifications

LISTING extant $NIX_PROFILES-dir:	/etc/profiles/per-user/qsu/etc/bash_completion.d

LISTING extant $NIX_PROFILES-dir:	/run/current-system/sw/etc/bash_completion.d

LISTING extant $XDG_DATA_DIRS-dir:	/nix/store/yjm6fzk4jizbgl5y1iwmi62mwrjw3b9h-gnome-shell-42.2/share/bash-completion/completions

LISTING extant $XDG_DATA_DIRS-dir:	/run/current-system/sw/share/bash-completion/completions
bootctl			devlink			localectl		nix			nix-hash		nixos-install		nix-shell		systemd-cat		systemd-nspawn		tracker3
busctl			gnome-control-center	loginctl		nix-build		nix-install-package	nixos-option		nix-store		systemd-cgls		systemd-path		udevadm
colormgr		gnome-extensions	machinectl		nix-channel		nix-instantiate		nixos-rebuild		nmcli			systemd-cgtop		systemd-resolve		udisksctl
coredumpctl		hostnamectl		mmcli			nix-collect-garbage	nixos-build-vms		nixos-version		resolvectl		systemd-delta		systemd-run
cpupower		journalctl		networkctl		nix-copy-closure	nixos-container		nix-prefetch-url	systemctl		systemd-detect-virt	tc
dconf			kmod			_nix			nix-env			nixos-generate-config	nix-push		systemd-analyze		systemd-id128		timedatectl

after installing some packages

completion with packages

here's the output I see after installing some of my always-installed programs
# 2022-07-09 forloop over $XDG_DATA_DIRS and $NIX_PROFILES paths on
# a fresh nixos 22.05 install via calamares (_after_ preferred packages
# added to /etc/nixos/configuration.nix and a `nixos-rebuild switch`)
LISTING extant $NIX_PROFILES-dir:	/etc/profiles/per-user/qsu/etc/bash_completion.d

LISTING extant $NIX_PROFILES-dir:	/run/current-system/sw/etc/bash_completion.d

LISTING extant $XDG_DATA_DIRS-dir:	/etc/profiles/per-user/qsu/share/bash-completion/completions
cargo		deno.bash	tmux		zathura

LISTING extant $XDG_DATA_DIRS-dir:	/nix/store/yjm6fzk4jizbgl5y1iwmi62mwrjw3b9h-gnome-shell-42.2/share/bash-completion/completions

LISTING extant $XDG_DATA_DIRS-dir:	/run/current-system/sw/share/bash-completion/completions
2to3			hostname		ppc-koji
7z			hostnamectl		prelink
7za			hping			printenv
a2x			hping2			protoc
abook			hping3			psql
aclocal			htop			puppet
aclocal-1.10		htpasswd		puppetca
aclocal-1.11		hunspell		puppetd
aclocal-1.12		_hwclock		puppetdoc
aclocal-1.13		iceweasel		puppetmasterd
aclocal-1.14		iconv			puppetqd
aclocal-1.15		id			puppetrun
aclocal-1.16		identify		pv
acpi			idn			pvchange
_adb			ifdown			pvcreate
add_members		ifquery			pvdisplay
alacritty.bash		ifstat			pvmove
alias			ifstatus		pvremove
alpine			iftop			pvs
alternatives		ifup			pvscan
animate			import			pwck
ant			influx			pwd
apache2ctl		info			pwdx
appdata-validate	inject			pwgen
apropos			inotifywait		pxz
apt-build		inotifywatch		pycodestyle
apt-cache		insmod			pydoc
apt-get			insmod.static		pydoc3
aptitude		installpkg		pydocstyle
aptitude-curses		interdiff		pyflakes
arch			invoke-rc.d		pylint
arm-koji		_ionice			pylint-2
arp			ip			pylint-3
arping			ipcalc			pypy
arpspoof		iperf			pypy3
asciidoc		iperf3			py.test
asciidoc.py		ipmitool		pytest
aspell			ipsec			py.test-2
autoconf		iptables		pytest-2
autoheader		ipv6calc		py.test-3
automake		iscsiadm		pytest-3
automake-1.10		isort			python
automake-1.11		isql			python2
automake-1.12		iwconfig		python2.7
automake-1.13		iwlist			python3
automake-1.14		iwpriv			python3.3
automake-1.15		iwspy			python3.4
automake-1.16		jar			python3.5
autoreconf		jarsigner		python3.6
autorpm			java			python3.7
autoscan		javac			python3.8
autossh			javadoc			pyvenv
autoupdate		javaws			pyvenv-3.4
avctrl			journalctl		pyvenv-3.5
badblocks		jpegoptim		pyvenv-3.6
bind			jps			pyvenv-3.7
bk			jq			pyvenv-3.8
bmake			jshint			qdbus
bootctl			jsonschema		qemu
brctl			json_xs			qemu-kvm
bsdtar			k3b			qemu-system-i386
btdownloadcurses.py	kcov			qemu-system-x86_64
btdownloadgui.py	kill			qrunner
btdownloadheadless.py	killall			querybts
bts			kldload			quota
busctl			kldunload		quotacheck
bzip2			kmod			quotaoff
c++			koji			quotaon
_cal			kplayer			radvdump
cancel			ktutil			ralsh
cardctl			l2ping			rcs
carton			larch			rcsdiff
cc			lastlog			rdesktop
ccache			lbzip2			rdict
ccze			ldapadd			remove_members
cdrecord		ldapcompare		removepkg
cfagent			ldapdelete		_renice
cfrun			ldapmodify		_repomanage
chage			ldapmodrdn		reportbug
change_pw		ldappasswd		repquota
check_db		ldapsearch		_reptyr
check_perms		ldapvi			resolvconf
checksec		ldapwhoami		resolvectl
_chfn			lftp			rfcomm
chgrp			lftpget			_rfkill
chkconfig		lilo			ri
chmod			links			rlog
chown			links2			rmlist
chpasswd		lintian			rmmod
chrome			lintian-info		route
chromium		lisp			rpcdebug
chromium-browser	list_admins		rpm
chronyc			list_lists		rpm2targz
chrpath			list_members		rpm2tgz
_chsh			list_owners		rpm2txz
ci			localectl		rpmbuild
ciptool			locale-gen		rpmbuild-md5
civclient		loginctl		rpmcheck
civserver		_look			rrdtool
cksfv			lpq			rsync
cleanarch		lpr			_rtcwake
clisp			lrzip			_runuser
clone_member		lsof			s390-koji
clzip			lsscsi			sbcl
co			lsusb			sbcl-mt
colormake		lua			sbopkg
colormgr		luac			scp
compare			luseradd		screen
compgen			luserdel		scrub
complete		lusermod		sdptool
composite		lvchange		secret-tool
config_list		lvcreate		setquota
configure		lvdisplay		sftp
conjure			lvextend		sh
convert			lvm			shellcheck
coredumpctl		lvmdiskscan		sidedoor
cowsay			lvreduce		sitecopy
cowthink		lvremove		slackpkg
cpan2dist		lvrename		slapt-get
cpio			lvresize		slapt-src
cppcheck		lvs			slogin
cpupower		lvscan			smartctl
createdb		lz4			smbcacls
createuser		lz4c			smbclient
crontab			lzip			smbcquotas
cryptsetup		lzma			smbget
curl			lzop			smbpasswd
cvs			machinectl		smbtar
cvsps			macof			smbtree
dconf			mailmanctl		snownews
dcop			mailsnarf		sparc-koji
dd			make			spovray
declare			makepkg			sqlite3
deja-dup		man			ss
desktop-file-validate	mc			ssh
devlink			mcrypt			ssh-add
dfutool			mdadm			ssh-copy-id
dhclient		mdecrypt		sshfs
dict			mdtool			ssh-keygen
display			medusa			sshmitm
_dmesg			mencoder		sshow
dmypy			micropython		star
dnssec-keygen		mii-diag		strace
dnsspoof		mii-tool		stream
dot			minicom			strings
dpkg			mkinitrd		_su
dpkg-deb		mkisofs			sudo
dpkg-query		mktemp			sudoedit
dpkg-reconfigure	mmcli			svcadm
dpkg-source		mmsitepass		svk
dropdb			_mock			_svn
dropuser		modinfo			_svnadmin
dselect			modprobe		_svnlook
dsniff			_modules		synclient
dumpdb			mogrify			sync_members
dumpe2fs		monodevelop		sysbench
e2freefrag		montage			sysctl
e2label			_mount			systemctl
ebtables		_mount.linux		systemd-analyze
ecryptfs-migrate-home	mozilla-firefox		systemd-cat
edquota			mplayer			systemd-cgls
_eject			mplayer2		systemd-cgtop
eog			mr			systemd-delta
ether-wake		msgsnarf		systemd-detect-virt
etherwake		msynctool		systemd-id128
evince			mtx			systemd-nspawn
explodepkg		munindoc		systemd-path
export			munin-node-configure	systemd-resolve
f77			munin-run		systemd-run
f95			munin-update		tar
faillog			mussh			tc
fbgs			mutt			tcpdump
fbi			muttng			tcpkill
feh			mypy			tcpnice
file			mysql			tightvncviewer
filebucket		mysqladmin		timedatectl
filefrag		nc			timeout
file-roller		ncal			tipc
filesnarf		ncftp			tox
find			nethogs			tracepath
find_member		networkctl		tracepath6
fio			_newgrp			tracker3
firefox			newlist			tshark
flake8			newusers		tsig-keygen
freebsd-update		ngrep			tune2fs
freeciv			_nix			typeset
freeciv-gtk2		nix			_udevadm
freeciv-gtk3		nix-build		udevadm
freeciv-sdl		nix-channel		udisksctl
freeciv-server		nix-collect-garbage	ulimit
freeciv-xaw		nix-copy-closure	_umount
function		nix-env			_umount.linux
fusermount		nix-hash		unace
g++			nix-install-package	unpack200
g4			nix-instantiate		unrar
g++-5			nixos-build-vms		unshunt
g++-6			nixos-container		update-alternatives
g++-7			nixos-generate-config	update-rc.d
g77			nixos-install		upgradepkg
g++-8			nixos-option		urlsnarf
g95			nixos-rebuild		useradd
gcc			nixos-version		userdel
gcc-5			nix-prefetch-url	usermod
gcc-6			nix-push		valgrind
gcc-7			nix-shell		vgcfgbackup
gcc-8			nix-store		vgcfgrestore
gccgo			nmap			vgchange
gccgo-5			_nmcli			vgck
gccgo-6			nmcli			vgconvert
gccgo-7			nproc			vgcreate
gccgo-8			nslookup		vgdisplay
gcj			nsupdate		vgexport
gcl			ntpdate			vgextend
gdb			oggdec			vgimport
genaliases		op			vgmerge
gendiff			openssl			vgmknodes
genisoimage		opera			vgreduce
geoiplookup		optipng			vgremove
geoiplookup6		p4			vgrename
getconf			pack200			vgs
getent			passwd			vgscan
gfortran		patch			vgsplit
gfortran-5		pbzip2			vigr
gfortran-6		pccardctl		vipw
gfortran-7		pdftotext		vmstat
gfortran-8		pdlzip			vncviewer
git			perl			vpnc
git-prompt.sh		perlcritic		watch
gkrellm			perldoc			webmitm
gkrellm2		perltidy		wget
gm			pgrep			whatis
gmake			phing			wine
gmplayer		pidof			wine-development
gnatmake		pigz			wine-stable
gnokii			pine			withlist
gnome-control-center	pinfo			wodim
gnome-extensions	ping			wol
gnome-mplayer		ping6			_write
gnome-screenshot	pkgadd			wsimport
gnumake			pkg-config		wtf
google-chrome		pkg_deinstall		wvdial
google-chrome-stable	pkg_delete		xdg-mime
gpasswd			pkg-get			xdg-settings
gpc			pkg_info		xfreerdp
gpg			pkgrm			xgamma
gpg2			pkgtool			xhost
gpgv			pkgutil			_xm
gpgv2			pkill			xmllint
gphoto2			plague-client		xmlwf
gprof			plzip			xmms
groupadd		pmake			xmodmap
groupdel		pm-hibernate		xpovray
groupmems		pm-is-supported		xrandr
groupmod		pm-powersave		xrdb
growisofs		pm-suspend		xsltproc
grpck			pm-suspend-hybrid	xvfb-run
gssdp-discover		pngfix			xvnc4viewer
gtar			portinstall		xxd
gzip			portsnap		xz
hciattach		portupgrade		xzdec
hciconfig		postalias		ypcat
hcitool			postcat			ypmatch
hd			postconf		_yum
hddtemp			postfix			yum-arch
_hexdump		postmap			zopfli
hid2hci			postsuper		zopflipng
host			povray

contents of /etc/nixos/configuration.nix providing said packages

here's the system config file with "always-installed programs" I mentioned
# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

  imports =
    [ # Include the results of the hardware scan.

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";

  # Setup keyfile
  boot.initrd.secrets = {
    "/crypto_keyfile.bin" = null;

  # Enable swap on luks
  boot.initrd.luks.devices."luks-my-disk-uuid-was-here".device = "/dev/disk/by-uuid/my-disk-uuid-was-here";
  boot.initrd.luks.devices."luks-my-disk-uuid-was-here".keyFile = "/crypto_keyfile.bin";

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = ",localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "America/New_York";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.utf8";

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the GNOME Desktop Environment.
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;

  # Configure keymap in X11
  services.xserver = {
    layout = "us";
    xkbVariant = "";

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.qsu = {
    isNormalUser = true;
    description = "qsu";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    #  thunderbird

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  #  wget

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "22.05"; # Did you read the comment?


Also, ha! just checked my previous (non-nix) daily laptop: nope nvim doesn’t complete there either … no idea how I became convinced it did. Anyway… this is has still been educational!

1 Like

Just read this thread. It was really cool to know all this

1 Like