I would like to put the contents of my fish.config into configuration.nix for reproducibility/central configuration.
E.g. in my fish.config i have the following entires:
if status is-interactive
set -g fish_key_bindings fish_default_key_bindings
bind \cc kill-whole-line repaint
bind \cd forward-char
set -g fish_greeting
fish_add_path ~/Dokumente/Install/Linux/Skripte
### Hinzugefügt für Emacs
# fish_add_path ~/.npm-global/bin
# fish_add_path ~/.config/composer/vendor/bin
fish_add_path ~/.emacs.d/bin
fish_add_path /run/current-system/sw/share/hunspell
end
zoxide init fish --cmd j | source
Entering them under programs.fish.shellInit or programs.fish.interactiveShellInit doesn’t work because Nixos complains about things like set -g or bind. I guess, because these are not normal commands but specific to fish.
How can i get around this? Do i have to escape the commands or is someting else the matter? Or am i just not meant to define my fish.config in configuration.nix?
I also couldn’t find out how to simply add contents to the system wide PATH although reading through a lot of google search results. They were dealing with making custom scripts or packages run, which isn’t my problem as far as i understand it.
So far, the only thing that i could transfer were global variables with environment.sessionVariables…
error: syntax error, unexpected '-', expecting '.' or '='
at /etc/nixos/configuration.nix:284:9:
283| programs.fish.interactiveHsellInit={
284| set -g fish_key_bindings fish_default_key_bindings
| ^
285| bind \cc kill-whole-line repaint
(use '--show-trace' to show detailed location information)
Regarding the path, i would like to add e.g. ~/Dokumente/Install/Linux/Skripte and ~/.emacs.d/bin to PATH and not an indiviual program within the directory. So i don’t want to work with a nix pkgs but just add the whole directory to PATH.
This is not a big issue of course because i can just leave it in fish.config but i was wondering if i could transfer all instructions from my fish.config to configuration.nix
They assume a fair bit of pre-knowledge though. Aiui a nix language tutorial is in the works which might be worth waiting for if you want to understand this kind of thing, presumably it will live on http://nix.dev