Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9p cache / VM options #3

Closed
dermetfan opened this issue Jan 17, 2019 · 3 comments
Closed

9p cache / VM options #3

dermetfan opened this issue Jan 17, 2019 · 3 comments

Comments

@dermetfan
Copy link
Contributor

dermetfan commented Jan 17, 2019

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.

@Mic92
Copy link
Owner

Mic92 commented Jan 18, 2019

I also thought about additional nixos options because environment variables become tedious to maintain https://github.com/Mic92/nixos-shell#ram

There is an option to pass additional parameters to qemu: https://github.com/nix-community/nixos-generators/blob/master/formats/vm.nix#L7
This could be extended for nixos-shell.

@Mic92
Copy link
Owner

Mic92 commented Jan 18, 2019

All options should be namespaced by some prefix like nixos-shell so we never collide with nixpkgs itself.

@Mic92
Copy link
Owner

Mic92 commented Jan 30, 2019

This one should be fixed by now.

@Mic92 Mic92 closed this as completed Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants