appvm/README.md

65 lines
1.5 KiB
Markdown
Raw Normal View History

2018-06-30 08:39:47 +00:00
# Nix app vms
2018-06-29 21:59:28 +00:00
2018-06-30 21:03:16 +00:00
Simple application VM's based on Nix package manager.
Designed primarily for full screen usage without guest additions.
2018-06-30 21:13:35 +00:00
It's a proof-of-concept, but you can still use it. Also there is a lot of strange things inside, don't afraid of :)
2018-06-30 21:03:16 +00:00
2018-06-30 08:39:47 +00:00
## Install Nix package manager
2018-06-29 21:59:28 +00:00
2018-06-30 08:39:47 +00:00
$ su -c 'mkdir -m 0755 /nix && chown user /nix'
$ curl https://nixos.org/nix/install | sh
2018-06-30 21:03:16 +00:00
## Dependencies
2018-06-30 08:39:47 +00:00
2018-06-30 21:03:16 +00:00
$ su -c 'USE="spice virtfs" emerge qemu virt-manager'
2018-06-30 08:39:47 +00:00
2018-06-30 21:03:16 +00:00
## Add appvm to PATH
2018-06-30 08:39:47 +00:00
2018-06-30 21:03:16 +00:00
$ echo 'PATH=$PATH:$HOME/appvm/bin' >> ~/.bashrc
2018-06-30 08:39:47 +00:00
2018-06-30 21:03:16 +00:00
(if you clone appvm to home directory)
## Generate resolution
By default uses 3840x2160. If you need to regenerate `appvm/nix/monitor.nix`:
$ appvm/appvm.sh generate-resolution 1920 1080 > appvm/nix/monitor.nix
Autodetection is a bash-spaghetti, so you need to check results. BTW it's just a X.org monitor section.
2018-06-30 21:03:16 +00:00
## Create VM
$ $HOME/appvm/appvm.sh build chromium
2018-06-30 21:03:16 +00:00
## Run application
2018-06-30 08:39:47 +00:00
2018-06-30 21:03:16 +00:00
$ appvm.chromium
2018-06-30 08:39:47 +00:00
2018-06-30 21:03:16 +00:00
## Shared directory
2018-06-29 21:59:28 +00:00
2018-06-30 21:03:16 +00:00
$ ls appvm/share/chromium
foo.tar.gz
bar.tar.gz
2018-06-30 22:08:41 +00:00
## Close VM
$ pkill.... :)
2018-06-30 22:10:39 +00:00
# App description
$ cat nix/chromium.nix
{pkgs, ...}:
{
imports = [
<nixpkgs/nixos/modules/virtualisation/qemu-vm.nix>
<nix/base.nix>
];
environment.systemPackages = [ pkgs.chromium ];
services.xserver.displayManager.sessionCommands = "while [ 1 ]; do ${pkgs.chromium}/bin/chromium; done &";
}
For create new app you should add package name (search at https://nixos.org/nixos/packages.html) and path to binary (typically same as package name).