appvm/README.md

73 lines
2.0 KiB
Markdown
Raw Normal View History

2020-01-05 06:03:59 +00:00
[![Documentation Status](https://readthedocs.org/projects/appvm/badge/?version=latest)](https://appvm.readthedocs.io/en/latest/?badge=latest)
2019-08-17 15:40:14 +00:00
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R8W2UQPZ5X5JE&source=url)
[![Donate](https://img.shields.io/badge/Donate-BitCoin-green.svg)](https://blockchair.com/bitcoin/address/bc1q23fyuq7kmngrgqgp6yq9hk8a5q460f39m8nv87)
2018-07-12 21:03:28 +00:00
# Nix application VMs: security through virtualization
2018-06-29 21:59:28 +00:00
2018-07-12 21:03:28 +00:00
Simple application VMs (hypervisor-based sandbox) based on Nix package manager.
2018-06-30 21:03:16 +00:00
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-05 07:46:31 +00:00
![appvm screenshot](screenshots/2018-07-05.png)
2020-01-26 01:39:36 +00:00
## Installation
2018-06-30 08:39:47 +00:00
2020-01-26 01:39:36 +00:00
### Requirements
2020-01-26 01:39:36 +00:00
$ sudo apt install virt-manager curl git
2020-01-26 19:15:53 +00:00
$ sudo usermod -a -G libvirt $USER # group can also be "libvirtd"
2020-01-26 01:39:36 +00:00
$ newgrp libvirt
$ echo user = "\"$USER\"" | sudo tee -a /etc/libvirt/qemu.conf
$ sudo systemctl restart libvirtd
2018-06-30 08:39:47 +00:00
2020-01-26 01:39:36 +00:00
### Install Nix package manager
$ sudo mkdir -m 0755 /nix && sudo chown $USER /nix
$ curl https://nixos.org/nix/install | sh
2020-01-26 10:23:33 +00:00
$ nix-channel --add https://nixos.org/channels/nixos-19.09 nixpkgs
$ . ~/.nix-profile/etc/profile.d/nix.sh
2020-01-26 01:39:36 +00:00
### Install appvm
2018-06-30 08:39:47 +00:00
2020-01-26 01:39:36 +00:00
$ nix-env -if https://code.dumpstack.io/tools/appvm/archive/master.tar.gz
2018-06-30 21:03:16 +00:00
2020-01-26 01:39:36 +00:00
## Usage
2020-01-26 01:39:36 +00:00
### Search for applications
2020-01-02 15:37:32 +00:00
$ appvm search chromium
2020-01-26 01:39:36 +00:00
### Run application
2018-06-30 21:03:16 +00:00
2020-01-02 15:17:22 +00:00
$ appvm start chromium
$ # ... long wait for first time, because we need to collect a lot of packages
2018-06-30 08:39:47 +00:00
2020-01-26 01:39:36 +00:00
### Synchronize remote repos for applications
2020-01-02 15:47:42 +00:00
$ appvm sync
2019-12-29 19:10:57 +00:00
You can customize local settings in **~/.config/appvm/nix/local.nix**.
2018-06-30 08:39:47 +00:00
2018-07-01 07:58:42 +00:00
Default hotkey to release cursor: ctrl+alt.
2020-01-26 01:39:36 +00:00
### Shared directory
2018-06-29 21:59:28 +00:00
2018-07-11 23:34:36 +00:00
$ ls appvm/chromium
2018-06-30 21:03:16 +00:00
foo.tar.gz
bar.tar.gz
2018-06-30 22:08:41 +00:00
2020-01-26 01:39:36 +00:00
### Close VM
2018-06-30 22:08:41 +00:00
2018-07-11 23:34:36 +00:00
$ appvm stop chromium
2018-06-30 22:10:39 +00:00
2020-01-26 01:39:36 +00:00
### Automatic ballooning
2018-07-12 20:00:57 +00:00
Add this command:
$ appvm autoballoon
to crontab like that:
$ crontab -l
* * * * * /home/user/dev/go/bin/appvm autoballoon