appvm/README.md

81 lines
2 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.
2018-07-01 08:21:15 +00:00
Uses one **read-only** /nix directory for all appvms. So creating a new appvm (but not first) is just about one minute.
2018-07-01 07:25:27 +00:00
2018-07-01 08:21:15 +00:00
Designed primarily for full screen usage (but remote-viewer has ability to resize window dynamically without change resolution) without guest additions (because of **less attack surface**).
2018-06-30 21:03:16 +00:00
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-07-05 07:46:31 +00:00
![appvm screenshot](screenshots/2018-07-05.png)
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
You can customize local settings in `nix/local.nix`.
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-07-01 07:58:42 +00:00
Default hotkey to release cursor: ctrl+alt.
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).
2018-07-01 08:35:25 +00:00
## Defined applications (pull requests are welcome!)
* chromium
* thunderbird
* tdesktop
2018-07-01 20:51:07 +00:00
* evince
2018-07-05 06:06:48 +00:00
* libreoffice