Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

meuter/devbox

Repository files navigation

Devbox

This project aims at making it easy to bootstrap my custom development box into VirtualBox. The intent here is not to have a full blown desktop environment, but rather a simple VM that can host a confortable (at least for me) software development experience (editing, compiling, testing...). I do mostly C/C++, python, and the occasional javascript and go. Here is a small overview:

Component Choice Reason
Distro Ubuntu 18.04.01 server easy to install, well documented, familiar
Desktop custom fork of i3 with bumblebee-status and custom config minimalistic, configurable, keyboard based
Launcher rofi keyboard based, prettier that dmenu
Terminal rxvt-unicode with custom config minimalistic, configurable
Dev. Editor (1) Visual Studio Code with some custom extensions user friendly, extensible, multi-language
Dev. Editor (2) NeoVIM with custom vimrc not user friendly, extensible, multi-language
Browser Google Chrome chrome dev tools
Shell oh-my-zsh with bullet-train theming, improved tab completion over bash
Display Manager slim with some custom themes tiny footprint, easy to configure
File Manager Thunar user friendly, familiar
Extra custom configs, autologin, samba share, fzf familiar

Thanks to Luke Smith and Code Path for inspiring this!

Install

  1. install virtual box (tested with v5.2)

  2. download Ubuntu 18.04.01 server iso image

  3. create a VM:

    1. At least 2Gb Ram
    2. At least 16Gb Disk
    3. Video memory 128Mb
    4. Two network adatper:
      1. NAT - guest can go online
      2. Host-Only - host only can connect to guest
    5. load the Ubuntu 18.04.01 server iso in the CDROM drive
  4. boot the VM and follow the Ubuntu installer's instruction

    • When configuring the network:
      • select static IP for the second (Host-Only) adapter
      • configure 192.168.56. (assuming the VBox Host Network Manager is configured on 192.168.56.xx, which is the default - adapt otherwise)
      • configure netmask 192.168.56.0/24 (same assumption, adapt otherwise)
  5. reboot the VM

  6. select "devices> install guest additions..." in virtualbox menu to load in the guest addition ISO.

  7. clone the project and run the main install script:

    git clone --depth=1 https://github.com/meuter/devbox ~/.devbox/
    cd ~/.devbox/install/
    ./install_dev_box.sh
    

    The script will prompt you to enter your password and then proceed with the installation and configuration of all the necessary packages. When finished, the VM will reboot automatically at the end.

  8. Start coding 🤓

  9. [optional] if you want to autologin on boot, run the following script:

    cd ~/.devbox/install/
    ./config_autologin.sh
    

Usage

i3 Keyboard Shortcut:

key function
f11 full screen focussed window
ctrl+f11 toggle status bar visibility
alt+<arrow> move focus
alt+shift+<arrow> move window
alt+<num> select worspace
control+shift+<arrow> select next/prev workspace
control+space select window using rofi
alt+space run command using rofi
alt+pause s shutdown
alt+pause r reboot
alt+pause e logout
alt+enter open terminal
alt+shift+enter open terminal in same working directory
ctrl+shift+g open chrome
ctrl+shift+o open vscode
ctrl+shift+t open thunar
ctrl+alt+c edit devbox in vim
alt+n rename current workspace

Network:

From the guest machine only, you can ssh into the box.

ssh <user>@<ip>

You can also mount your home directory from a Windows host machine. For that, open the file explorer, go to "Computer> Map Network Drive..." and use the following address:

\\<ip>\<username>

Use your user name and password.

git alias and shortcuts:

Git is configured with the following git aliase:

Git Alias Meaning Command Console Alias(1)
diff diff against HEAD diff --no-pager d
wtf short status status -s w
recent recent change current branch log -5 --color --pretty=tformat:'%C(yellow)%h%Creset [%><(18)%cr] %C(white)%<(70,trunc)%s%Creset (%cn)' r
in incoming commits(2) !git remote update -p; git log --color --pretty=tformat:'%C(yellow)%h%Creset [%><(18)%cr] %Cred%<(70,trunc)%s%Creset (%cn)' ..@{u} i
out outgoing commits(2) log --color --pretty=tformat:'%C(yellow)%h%Creset [%><(18)%cr] %Cred%<(70,trunc)%s%Creset (%cn)' @{u}.. o
lol pretty log current branch log --decorate --pretty=oneline --abbrev-commit --color l
lolg pretty log all branches log --graph --decorate --pretty=oneline --abbrev-commit --all --color
update update workspace !git stash; git pull --rebase; git stash pop
wipe go back to HEAD !git reset --hard HEAD; git clean -fd
progress add currently tracked changes to last commit commit -a --amend --reuse-message HEAD"
meld compare using meld difftool -d(3)
revin review incoming changes without merging them "!git remote update -p; git difftool -d @{u}"

Notes:

  • (1) you can type this in the terminal instead of "git <alias>"
  • (2) needs the current branch to track some remote branch
  • (3) meld is configured as the default git difftool.

Screenshots

Login Screen

login.jpg

Empty Desktop

desktop.jpg

Terminal & NeoVIM

terminal.jpg

Visual Studio Code & Google Chrome

code.jpg