How can I push more dotfiles content with flox?


I followed the steps in this blog post.
When I push the dotfiles environment I am only pushing a flox.nix file. However a big part of my zsh configuration, starting with the .zshrc file is still inside the ~/.dotfiles directory and not pushed anywhere. This means I can’t download it from another machine.

What would you recommend in order to fully push all the zsh configuration?


One way of handling this could be to “package” your .zshrc as a simple text file to be “installed” to a flox environment.

For example if you created a small flake that defines a package using nixpkgs#writeTextFile with the name zshrc and upload it to GitHub, you could then flox install github:<USER>/<REPO>#zshrc.

Alternatively you could define a shell.hook which recreates your zshrc.

I actually need to package many files and directories. I’ll try to make it a flox project and publish it, thanks!

This framework may be of interest to you: GitHub - flox/etc-profiles: Installable `/etc/profile.d` activation scripts for use with `flox`

It’s a pet project I’ve been working on for a while to provide “installable” setup scripts like .zshrc and .bashrc.

I expect to make a few tweaks to the public interface and do some guides/docs soon; but an intrepid explorer might still enjoy using it today.

To add your own profile scripts you can essentially just use writeTextFile or derivation to create files in $out/etc/profile.d/<NAME>.sh, and this framework will load them with flox activate. I was using numbers in the filenames to control the order that scripts run in which is the only real trick you might want to know if you try it out before we do documentation and guides.

Enjoy <3