Skip to content

9p cache / VM options #3

@dermetfan

Description

@dermetfan

When I'm working on web stuff I like to mount the docroot into the VM with --mount so I can edit files on the host and see the effects immediately. Unfortunately cache=loose means the guest keeps the old version of the file for random time intervals (sometimes over a minute) so this workflow is blocked.

Before I start working on this I would like to agree on a plan. I had a few ideas:

  • add --mount-cache to specify how all directories are mounted
  • extend --mount to specify mount options on a per-directory basis, eg: --mount,cache=none /host /guest

These involve a bit of work on the command line parsing though and that may become more complex as nixos-shell evolves.

Perhaps it would be better to incorporate VM options into the vm.nix file itself so we can leverage the whole NixOS module system, akin to the way NixOps does it (deployment.targetEnv etc). We may end up with something like this:

{
  vm.mounts = {
    mountHome = true;
    mountNixProfile = true;

    # defaults
    cache = "loose";

    extraMounts = {
      # uses defaults defined above
      "/tank" = "/tank";

      "/var/www" = {
        target = "./src";
        cache = "none";
      };
    };
  };

  # normal NixOS options…
}

I would love to hear your take on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions