Fish shell includes python by default ?!

Hello everyone,

Today, while optimizing the closure size of a Home-Manager profile, I discovered that including Python3 significantly increased the size. Specifically, Python3 set the fish derivation’s size to 220MB.

❯ nix path-info --recursive --size --closure-size --human-readable /nix/store/rswmlkz46y7svb399kfzvp3gdihml8mg-fish-3.7.1
/nix/store/rswmlkz46y7svb399kfzvp3gdihml8mg-fish-3.7.1            14.6M  220.8M

Upon examining the Fish derivation, I found a parameter usePython set to true by default. ={
  usePython = false;

When I rebuilt the profile with usePython set to false, its size dropped to 92MB.

❯ nix path-info --recursive --size --closure-size --human-readable /nix/store/7bg7lhhvbp5fmf75bkb6a3dcn8958r7a-pol-fish-completions -L --impure
/nix/store/mgmn7cyjriy65z27hijfma2habq4779y-fish-3.7.1            14.6M   92.3M

It appears that Python is primarily used to run fish_config, the web-based interface for configuring Fish.

Given this, I opened this thread to discuss whether the usePython flag should default to false to optimize the closure size for users who do not require the web configuration interface. In this Nix context, Fish is usually configured through Home-Manager and/or custom config files. I guess not so many people are aware of this config interface anyway, but I might be wrong.

To fix this, we could for example use python from the path if it is available. If it’s there it works, if not, just bails out with an error message.

Curious to hear your thoughts and suggestions on this matter,


1 Like


I’ve been a fish shell user for the last 12 years, and only run that web-based interface once, said “wow, that’s super nice !”, and closed it forever.

I think we could turn that off by default, and provide another fish_config package for those who use it.

But it looks like python is also used to generate autocompletions from manpages, which is a feature I use a lot.

1 Like

Maybe replace the fish_config script’s shebang with a #! nix-shell kind of expression. Alternatively wrap it with a shell script that looks for python in PATH and errors with instructions on how to get it into your sell?

Mmmh… the official Dockerfile doesn’t use Python and I don’t see any reference to manpage generation there in the Fish derivation file.

I found it in nixpkgs/pkgs/shells/fish/default.nix at 90055d5e616bd943795d38808c94dbf0dd35abe8 · NixOS/nixpkgs · GitHub :

used to generate autocompletions from manpages and for configuration editing in the browser

and this usePython sets __fish_anypython, which is used in 11 files in share/completions:

I see, thanks.

I’ve opened a PR, let’s continue the work in there fish: remove `python` from dependencies by drupol · Pull Request #304313 · NixOS/nixpkgs · GitHub if it worth it.

I would not be surprised if centos Docker image shipped Python by default.

That is the fish_update_completions tool, which calls the script.