I want to use nix to build my development environment as a docker image, and I see the dockertools, most of the packages could be added by contents, like tmux, vim, vim plugins, git, fish. But I don’t know how to use programs to custom the tools in dockertools, like tmux
programs.tmux = {
enable = true;
clock24 = true;
extraTmuxConf = '' # used for less common options, intelligently combines if defined in multiple places.
...
'';
}
Is that possible to use programs in dockertools?
Thanks
Sadly, no, the docker images don’t produce full nixos systems, so you cannot use nixos modules - this is because docker isn’t really a good environment to run things like systemd in, and most nixos modules heavily rely on having access to those basic system components.
To add simple configuration, you’ll need to manually write the configuration files and add them in a custom layer (or package them and add them to contents).
If you want to use nixos options in a container, consider using a NixOS container, a VM using build-vm, or look for third party projects that build docker images using nix.
nixos container would not be my solution, because I need to deploy the develop environment to other linux os, so I need oci image to wrap it.
Systemd is not need by my docker image,
To add simple configuration, you’ll need to manually write the configuration files and add them in a custom layer (or package them and add them to contents ).
Is there any example to pack the simple configuration?
Yes, but the nixos modules you use need it to set up various things like temporary directories. Without those basic components a nixos system can’t be built, and hence there is no way to use nixos modules with dockerTools.
Sadly, not that I’m aware of. I’d try building a simple derivation with stdenv and seeing where the files end up if I put it in contents, it should be fairly easy to figure out from there.