From d076f4711b6f4ea944e49d8bf96d78e9dea76e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Thu, 26 Jan 2017 05:44:03 +0000 Subject: [PATCH] Add Mac support (#89) --- .gitconfig_includes.mac | 33 ++--- .gitmodules | 3 - .hyper.js | 102 +++++++++++++++ .hyper_plugins/.hyper_plugins | 1 + .hyper_plugins/package.json | 12 ++ .tmux.conf | 1 + .travis.yml | 35 +++-- .zshrc | 5 - common/configure_fresh_system.sh | 21 ++- mac/Solarized Dark.itermcolors | 213 ------------------------------- macosx/configure_fresh_system.sh | 94 ++++++++++++++ test.sh | 7 + tools/runjessie | 5 +- tools/subuser | 1 - travis/configure_fresh_system.sh | 15 --- 15 files changed, 270 insertions(+), 278 deletions(-) create mode 100644 .hyper.js create mode 120000 .hyper_plugins/.hyper_plugins create mode 100644 .hyper_plugins/package.json delete mode 100644 mac/Solarized Dark.itermcolors create mode 100755 macosx/configure_fresh_system.sh delete mode 160000 tools/subuser delete mode 100755 travis/configure_fresh_system.sh diff --git a/.gitconfig_includes.mac b/.gitconfig_includes.mac index 8a493398..459ab8bc 100644 --- a/.gitconfig_includes.mac +++ b/.gitconfig_includes.mac @@ -1,26 +1,13 @@ - -[mergetool "filemerge"] - cmd = /Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge -merge $MERGED -left $LOCAL -ancestor $BASE -right $REMOTE - trustExitCode = false -[core] - excludesfile = /Users/cplotnicki/.gitignore_global -[difftool "kdiff3"] - path = /Applications/kdiff3.app/Contents/MacOS/kdiff3 - trustExitCode = false -[difftool] - prompt = false -[diff] - tool = kdiff3 -[mergetool "kdiff3"] - path = /Applications/kdiff3.app/Contents/MacOS/kdiff3 +[merge] + keepBackup = false + tool = p4merge +[mergetool "p4merge"] + cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\"" + keepTemporaries = false trustExitCode = false keepBackup = false -[merge] - tool = kdiff3 -[difftool "sourcetree"] - cmd = opendiff \"$LOCAL\" \"$REMOTE\" - path = -[mergetool "sourcetree"] - cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" - trustExitCode = true +[diff] + tool = p4merge +[difftool "p4merge"] + cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$REMOTE\"" "\"$LOCAL\"" diff --git a/.gitmodules b/.gitmodules index 2ac16912..04f9aad7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "tools/icdiff.git"] path = tools/icdiff.git url = https://github.com/jeffkaufman/icdiff.git -[submodule "tools/subuser"] - path = tools/subuser - url = https://github.com/subuser-security/subuser [submodule ".vim/bundle/Vundle.vim"] path = .vim/bundle/Vundle.vim url = https://github.com/VundleVim/Vundle.vim.git diff --git a/.hyper.js b/.hyper.js new file mode 100644 index 00000000..fb24c82f --- /dev/null +++ b/.hyper.js @@ -0,0 +1,102 @@ +module.exports = { + config: { + // default font size in pixels for all tabs + fontSize: 14, + + // font family with optional fallbacks + fontFamily: '"DejaVu Sans Mono for Powerline", "DejaVu Sans Mono", Menlo, Consolas, "Lucida Console", monospace', + + // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) + cursorColor: 'rgba(248,28,229,0.8)', + + // `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █ + cursorShape: 'BLOCK', + + // color of the text + foregroundColor: '#fff', + + // terminal background color + backgroundColor: '#000', + + // border color (window, tabs) + borderColor: '#333', + + // custom css to embed in the main window + css: '', + + // custom css to embed in the terminal window + termCSS: '', + + // set to `true` if you're using a Linux set up + // that doesn't shows native menus + // default: `false` on Linux, `true` on Windows (ignored on macOS) + showHamburgerMenu: '', + + // set to `false` if you want to hide the minimize, maximize and close buttons + // additionally, set to `'left'` if you want them on the left, like in Ubuntu + // default: `true` on windows and Linux (ignored on macOS) + showWindowControls: '', + + // custom padding (css format, i.e.: `top right bottom left`) + padding: '12px 14px', + + // the full list. if you're going to provide the full color palette, + // including the 6 x 6 color cubes and the grayscale map, just provide + // an array here instead of a color map object + colors: { + black: '#000000', + red: '#ff0000', + green: '#33ff00', + yellow: '#ffff00', + blue: '#0066ff', + magenta: '#cc00ff', + cyan: '#00ffff', + white: '#d0d0d0', + lightBlack: '#808080', + lightRed: '#ff0000', + lightGreen: '#33ff00', + lightYellow: '#ffff00', + lightBlue: '#0066ff', + lightMagenta: '#cc00ff', + lightCyan: '#00ffff', + lightWhite: '#ffffff' + }, + + // the shell to run when spawning a new session (i.e. /usr/local/bin/fish) + // if left empty, your system's login shell will be used by default + shell: '/usr/local/bin/zsh', + + // for setting shell arguments (i.e. for using interactive shellArgs: ['-i']) + // by default ['--login'] will be used + shellArgs: ['--login'], + + // for environment variables + env: {}, + + // set to false for no bell + bell: false, + + // if true, selected text will automatically be copied to the clipboard + copyOnSelect: false + + // URL to custom bell + // bellSoundURL: 'http://example.com/bell.mp3', + + // for advanced config flags please refer to https://hyper.is/#cfg + }, + + // a list of plugins to fetch and install from npm + // format: [@org/]project[#version] + // examples: + // `hyperpower` + // `@company/project` + // `project#1.0.1` + plugins: [ + 'hyper-solarized-dark' + ], + + // in development, you can create a directory under + // `~/.hyper_plugins/local/` and include it here + // to load it and avoid it being `npm install`ed + localPlugins: [] +}; diff --git a/.hyper_plugins/.hyper_plugins b/.hyper_plugins/.hyper_plugins new file mode 120000 index 00000000..08c80e70 --- /dev/null +++ b/.hyper_plugins/.hyper_plugins @@ -0,0 +1 @@ +/Users/cyryl/dev/dotfiles/.hyper_plugins \ No newline at end of file diff --git a/.hyper_plugins/package.json b/.hyper_plugins/package.json new file mode 100644 index 00000000..b6eca5bf --- /dev/null +++ b/.hyper_plugins/package.json @@ -0,0 +1,12 @@ +{ + "name": "hyper-plugins", + "description": "Auto-generated from `~/.hyper.js`!", + "private": true, + "version": "0.0.1", + "repository": "zeit/hyper", + "license": "MIT", + "homepage": "https://hyper.is", + "dependencies": { + "hyper-solarized-dark": "latest" + } +} \ No newline at end of file diff --git a/.tmux.conf b/.tmux.conf index 2e83a536..14020b84 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,3 +1,4 @@ +set-option -g default-command "reattach-to-user-namespace -l zsh" set -g mouse on set -g terminal-overrides 'xterm*:smcup@:rmcup@' set -g prefix C-a # prefix from ctrl-b to ctrl-a diff --git a/.travis.yml b/.travis.yml index 099f85c6..e5f668b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,27 @@ -language: - - bash - -script: - - ./test.sh - -env: - - DETECTED_OS=fedora:24 DOCKER_IMAGE=cyplo/fedora24_base - - DETECTED_OS=fedora:25 DOCKER_IMAGE=cyplo/fedora25_base - - DETECTED_OS=debian:jessie DOCKER_IMAGE=cyplo/jessie_base - - DETECTED_OS=ubuntu:xenial DOCKER_IMAGE=cyplo/xenial_base - - DETECTED_OS=ubuntu:yakkety DOCKER_IMAGE=cyplo/yakkety_base - +language: bash sudo: required services: - docker + +dist: trusty + +matrix: + include: + - os: osx + osx_image: xcode8.2 + - os: linux + env: DETECTED_OS=fedora:24 DOCKER_IMAGE=cyplo/fedora24_base + - os: linux + env: DETECTED_OS=fedora:25 DOCKER_IMAGE=cyplo/fedora25_base + - os: linux + env: DETECTED_OS=debian:jessie DOCKER_IMAGE=cyplo/jessie_base + - os: linux + env: DETECTED_OS=ubuntu:xenial DOCKER_IMAGE=cyplo/xenial_base + - os: linux + env: DETECTED_OS=ubuntu:yakkety DOCKER_IMAGE=cyplo/yakkety_base +script: + - ./test.sh + git: submodules: false - diff --git a/.zshrc b/.zshrc index e0acf602..1f8c3c8e 100644 --- a/.zshrc +++ b/.zshrc @@ -31,11 +31,6 @@ prompt_dir() { prompt_segment blue $PRIMARY_FG ' %1~ ' } -# aliases -if [[ `uname` == 'Darwin' ]]; then - alias vim=/usr/local/Cellar/vim/7.4/bin/vim -fi - if [[ `uname` =~ 'CYGWIN.*' ]]; then export DISPLAY=:0.0 fi diff --git a/common/configure_fresh_system.sh b/common/configure_fresh_system.sh index b5fc45ef..0d8c6ffb 100755 --- a/common/configure_fresh_system.sh +++ b/common/configure_fresh_system.sh @@ -19,7 +19,6 @@ if [[ -z $DONT_CHANGE_SHELL ]]; then fi CURL="curl -sSfL" -jobs_count=`nproc` if [[ -z $DIR ]]; then echo "please set DIR" @@ -41,6 +40,8 @@ ln -vfs "$DIR/.zpreztorc" ~/.zpreztorc ln -vfs "$DIR/.zprofile" ~/.zprofile ln -vfs "$DIR/.zprezto/runcoms/zshenv" ~/.zshenv ln -vfs "$DIR/.zshrc" ~/.zshrc +ln -vfs "$DIR/.hyper.js" ~/.hyper.js +ln -vfs "$DIR/.hyper_plugins" ~/.hyper_plugins ln -vfs "$DIR/.setenv.sh" ~/.setenv ln -vfs "$DIR/.Slic3r" ~/. @@ -63,7 +64,9 @@ source ~/.setenv # symlink 'nodejs' as node on some systems # will replace symlink if it exists, but won't replace regular file if [[ ! -f /usr/bin/node ]]; then - $SUDO ln -vfs /usr/bin/nodejs /usr/bin/node + if [[ -f /usr/bin/nodejs ]]; then + $SUDO ln -vfs /usr/bin/nodejs /usr/bin/node + fi fi # tools @@ -107,6 +110,18 @@ set +e cargo install racer cargo install rustsym cargo install ripgrep + + cd "$DIR/../" + if [[ ! -d alacritty ]]; then + git clone https://github.com/jwilm/alacritty.git --recursive + cd alacritty + else + cd alacritty + git pull + git submodule update --init --recursive + fi + rustup override set `cat rustc-version` + cargo install set -e fi @@ -203,7 +218,7 @@ fi # normalize npm permissions mkdir -p $HOME/.npm -$SUDO chown $USER $HOME/.npm -R +$SUDO chown -R $USER $HOME/.npm echo echo "now go ahead and restart" diff --git a/mac/Solarized Dark.itermcolors b/mac/Solarized Dark.itermcolors deleted file mode 100644 index ed31a4a5..00000000 --- a/mac/Solarized Dark.itermcolors +++ /dev/null @@ -1,213 +0,0 @@ - - - - - Ansi 0 Color - - Blue Component - 0.19370138645172119 - Green Component - 0.15575926005840302 - Red Component - 0.0 - - Ansi 1 Color - - Blue Component - 0.14145714044570923 - Green Component - 0.10840655118227005 - Red Component - 0.81926977634429932 - - Ansi 10 Color - - Blue Component - 0.38298487663269043 - Green Component - 0.35665956139564514 - Red Component - 0.27671992778778076 - - Ansi 11 Color - - Blue Component - 0.43850564956665039 - Green Component - 0.40717673301696777 - Red Component - 0.32436618208885193 - - Ansi 12 Color - - Blue Component - 0.51685798168182373 - Green Component - 0.50962930917739868 - Red Component - 0.44058024883270264 - - Ansi 13 Color - - Blue Component - 0.72908437252044678 - Green Component - 0.33896297216415405 - Red Component - 0.34798634052276611 - - Ansi 14 Color - - Blue Component - 0.56363654136657715 - Green Component - 0.56485837697982788 - Red Component - 0.50599193572998047 - - Ansi 15 Color - - Blue Component - 0.86405980587005615 - Green Component - 0.95794391632080078 - Red Component - 0.98943418264389038 - - Ansi 2 Color - - Blue Component - 0.020208755508065224 - Green Component - 0.54115492105484009 - Red Component - 0.44977453351020813 - - Ansi 3 Color - - Blue Component - 0.023484811186790466 - Green Component - 0.46751424670219421 - Red Component - 0.64746475219726562 - - Ansi 4 Color - - Blue Component - 0.78231418132781982 - Green Component - 0.46265947818756104 - Red Component - 0.12754884362220764 - - Ansi 5 Color - - Blue Component - 0.43516635894775391 - Green Component - 0.10802463442087173 - Red Component - 0.77738940715789795 - - Ansi 6 Color - - Blue Component - 0.52502274513244629 - Green Component - 0.57082360982894897 - Red Component - 0.14679534733295441 - - Ansi 7 Color - - Blue Component - 0.79781103134155273 - Green Component - 0.89001238346099854 - Red Component - 0.91611063480377197 - - Ansi 8 Color - - Blue Component - 0.15170273184776306 - Green Component - 0.11783610284328461 - Red Component - 0.0 - - Ansi 9 Color - - Blue Component - 0.073530435562133789 - Green Component - 0.21325300633907318 - Red Component - 0.74176257848739624 - - Background Color - - Blue Component - 0.15170273184776306 - Green Component - 0.11783610284328461 - Red Component - 0.0 - - Bold Color - - Blue Component - 0.56363654136657715 - Green Component - 0.56485837697982788 - Red Component - 0.50599193572998047 - - Cursor Color - - Blue Component - 0.51685798168182373 - Green Component - 0.50962930917739868 - Red Component - 0.44058024883270264 - - Cursor Text Color - - Blue Component - 0.19370138645172119 - Green Component - 0.15575926005840302 - Red Component - 0.0 - - Foreground Color - - Blue Component - 0.51685798168182373 - Green Component - 0.50962930917739868 - Red Component - 0.44058024883270264 - - Selected Text Color - - Blue Component - 0.56363654136657715 - Green Component - 0.56485837697982788 - Red Component - 0.50599193572998047 - - Selection Color - - Blue Component - 0.19370138645172119 - Green Component - 0.15575926005840302 - Red Component - 0.0 - - - diff --git a/macosx/configure_fresh_system.sh b/macosx/configure_fresh_system.sh new file mode 100755 index 00000000..65ada9a3 --- /dev/null +++ b/macosx/configure_fresh_system.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" > /etc/shells" +fi + +echo "Brew cleanup" +brew linkapps +brew cleanup +brew prune +brew doctor + +echo "Configuring NVRAM" +sudo nvram SystemAudioVolume=%80 + +DIR="$DIR/../" +if [[ -z $CONTINUOUS_INTEGRATION ]]; then + echo "Invoking common configuration scripts" + DIR="$DIR" $DIR/common/configure_fresh_system.sh +fi +ln -vfs "$DIR/.gitconfig.mac" ~/.gitconfig + diff --git a/test.sh b/test.sh index 8cdec1a2..fc6a56b4 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,11 @@ #!/bin/bash +set -e + +if [[ $TRAVIS_OS_NAME == "osx" ]]; then + export DONT_CHANGE_SHELL=true + ./macosx/configure_fresh_system.sh + exit 0 +fi if [[ -z $DETECTED_OS ]]; then echo "cannot detect OS, please set DETECTED_OS manually" diff --git a/tools/runjessie b/tools/runjessie index 6edaeb26..0223c3ce 100755 --- a/tools/runjessie +++ b/tools/runjessie @@ -13,5 +13,8 @@ RESOLVED_ARGUMENTS="$@" docker run -i -t -v "$CURRENT_DIRECTORY":"$MOUNT_PATH":Z $IMAGE bash -c "useradd -M -d '$MOUNT_PATH' $USERNAME && cd '$MOUNT_PATH' && bash -c '$RESOLVED_ARGUMENTS'" # restore SELinux context for the current directory -restorecon -R "$CURRENT_DIRECTORY" +restorecon_path=`which restorecon` +if [[ -x "$restorecon_path" ]]; then + restorecon -R "$CURRENT_DIRECTORY" +fi diff --git a/tools/subuser b/tools/subuser deleted file mode 160000 index 9a21e867..00000000 --- a/tools/subuser +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9a21e86753a7a3d4628aa612558291c9108fdc16 diff --git a/travis/configure_fresh_system.sh b/travis/configure_fresh_system.sh deleted file mode 100755 index 920cd437..00000000 --- a/travis/configure_fresh_system.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# detect if building inside a CI system, like Travis -set -e -echo "choosing totally noninteractive installation method" -COMMAND_PREFIX="DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confnew\""; - -curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -sudo apt-get update -INSTALL_COMMAND="sudo $COMMAND_PREFIX install meld whois zsh tmux vim atop aria2 curl pv gajim tor torsocks nodejs terminator gsmartcontrol python-pip mesa-utils mesa-utils-extra aptitude p7zip-full p7zip-rar thunderbird mercurial kdiff3 gnupg2 python3-setuptools realpath python3-dev python3 apt-file golang" -eval ${INSTALL_COMMAND} - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -DIR="$DIR/../" -DONT_CHANGE_SHELL=TRUE DIR="$DIR" $DIR/common/configure_fresh_system.sh -