I’d love to containerize all of my local development efforts (scripts and rails apps) but the slow ass filesystem always ruined it in the past.
I’d love to containerize all of my local development efforts (scripts and rails apps) but the slow ass filesystem always ruined it in the past.
I believe multipass uses SSHFS (https://discourse.ubuntu.com/t/how-to-improve-mounts-perform...) to mount filesystems between the host and the VM. Performance has been excellent.
Lately I’ve been trying https://devenv.sh/ and it works great!
I haven’t tried it for ruby, though I have used vanilla nix shell for ruby projects before and it worked quite well after I over-rode GEM_PATH and GEM_HOME to the correct values.
Can devenv environment put itself in a chroot / sandbox where it cannot access my files, and is firewalled by default?
nix file helps you build OCI image and then you run it not locally/somewhere else?
can that be compared apples to apples to docker where you can build with Dockerfile syntax, and then run locally the image?
(Aside: you can build oci images using nix, but that’s probably what you would use for building deployable artifacts for production, not for development).
I would not say it is comparable with a Dockerfile - a Dockerfile is closer to a shell script, with caching between each step. Credit to Dockerfile syntax for being very easy to grok, but it is inherently not reproducible.
The perceived reliability of docker for development probably comes from the fact that you can share a prebuilt image, but rebuilding might not always work.
Like Mitchell Hashimoto (Hashicorp), I no longer do any development on macOS directly; I have a Linux VM where all my projects live and have their environments managed with a shell.nix file. Highly highly recommend it.
shell.nix - this brings the packages I need to develop into the $PATH when I run `nix-shell` in the repo
{pkgs ? import <nixpkgs> {}}:
with pkgs;
mkShell {
buildInputs = [
meilisearch
openssl
overmind
pkg-config
postgresql
rustup
tmux
];
shellHook = ''
export OVERMIND_PROCFILE=Procfile.dev
export PGDATA="data.pg"
export MEILI_DB_PATH="data.ms"
'';
}
Procfile.dev - this is used to start the background services I need, the format is "name: command" postgres: postgres -K /tmp
meilisearch: meilisearch
Then I can run `nix-shell` to load all the dependencies and `overmind start` to bring up Postgres + Meilisearch with ignored data dirs relative to the project folder. If any of these packages need to be pinned to a specific version you can do that with this tool[1].That's pretty much it - with all the background services running you can load your monolith or microservices with cargo/npm/etc. It's all very nice and clean!
[1]: https://lazamar.co.uk/nix-versions/ - I actually just used this in a new shell.nix for my personal website to pin a version of Hugo from 2019 (when I last touched it) so that it would build again
I think the new virtualization framework just came out of beta though so now it’s just VirtuoFS that needs to be enabled.
Make sure that you're running a recent version of Lima, and use a 9p mount.
Edit: by editing one of these yamls: https://github.com/lima-vm/lima/tree/master/examples
If you use VS Code the remoting extensions pack includes SSH, for my personal laptop, I'm usually using code to my linux desktop, and editing remotely... it's pretty slick. Code will run a "code server" in the remote environment, and is effectively just displaying the text view to you, the actual work is happening in the remote envornment. You can do similar with containers, or in windows+wsl.
They all use the underlying OS hypervisor so I’m not sure you can get perceivable performance out of one solution over the other.
What do you mean? Multipass only runs Ubuntu server cloud images.