How to set custom app configuration in nixos

Im still not Nixos user but have some questions.
Can set custom config files like .bashrc , .vimrc or similar with nix
Can I download them from the net with script or take them from the local machine and put them in the correct place
Can I run bash script or other in nix config

Files that live in the home directory such as ~/.bashrc can be managed declaratively with nix, but not with Nixos itself. Home-manager is intended for that purpose.

Often, people will configure individual settings with nix code and have a configuration file automatically created from those options, but it is also possible to put files into place in the home directory verbatim.

Keep in mind that nix is inherently declarative, so you can’t just run arbitrary imperative code. There are various highly general tools such as activation snippets, though, which can handle a whole lot of tasks if the more typical options like placing files and adding systemd user services can’t do so.

1 Like