3 ms·
What are the productivity advantages over using Docker images?
by jimbokun 3y ago
What are the productivity advantages over using Docker images?
- ngruhn 3y agoFor me the big advantage is that it integrates much easier with my development environment. For example if I have a language server for some programming language running in Docker, it’s not obvious to me how to make it talk to my editor on the host. I can expose a port but both the editor and the language server need access to the code base I’m working on. I can mount the code base as a volume but the language server gets confused about absolute paths that are not matching and stuff like this.
- chriswarbo 3y agoDocker images of what? Docker cannot read minds; it has to be told what to put in those images. Nix is a tool for saying what you want; in a more sensible way than the de facto standard of "grab an entire Ubuntu installation, then run `apt-get -y` commands because I don't understand dpkg".
- megaloblasto 3y agoI agree with ngruhn that the integration of Nix with my entire development environment is much more seamless then docker images. I think what chriswarbo is getting at is that docker and Nix often have very different use cases. In my case, I have a few different computers, and I declare all of their environments with NixOS in the same directory. Then I use syncthing so that all the builds are automatically updated and in sync. This means that I can develop something on my desktop, and open up my laptop and run it without configuring anything. If it works on my desktop, it works on my laptop and vise-versa.
- pxc 3y agoHow do you use syncthing for Nix builds? Do you sync your Nix code and have something watch the Nix code and rebuild in the background?
- megaloblasto 3y agoI do not, although that would be cool. If I make changes to my nixos config I just type "rebuild" in the terminal on which ever computer was affected. I have "rebuild" aliased to "sudo nixos-rebuild switch --flake /home/user/nixos/#machine_name" on each machine. For example, I make a development environment on my desktop using a flake.nix file and a .envrc file in directory. I type direnv allow in that directory (actually all this is done with a script I wrote so I can just type "dev-env" in the terminal in the corresponding directory". Then open my laptop, syncthing makes it so the entire environment and all the files are already on my laptop. I type "direnv allow" in the directory in my laptop, and then "rebuild" if the NixOS configuration was changed. Then I can run the software that I wrote on the desktop.