From 9dd13fbef773b035b090f5b761637824dd0160be Mon Sep 17 00:00:00 2001 From: Ben Dixon Date: Mon, 22 Nov 2021 14:52:15 +0000 Subject: [PATCH] adds: m1 compatibility --- ansible_osx.yml | 121 +++++++++++++++----------------------------- bin/bootstrap | 8 +-- requirements.yml | 5 +- templates/.zshrc.j2 | 9 ++-- 4 files changed, 52 insertions(+), 91 deletions(-) diff --git a/ansible_osx.yml b/ansible_osx.yml index 8b16d3c..67ad7e9 100644 --- a/ansible_osx.yml +++ b/ansible_osx.yml @@ -3,11 +3,15 @@ tasks: - name: Install homebrew include_role: - name: geerlingguy.homebrew + name: geerlingguy.mac.homebrew - - name: Setup dnsmasq - include_role: - name: dnsmasq + - name: Make sure homebrew bin is in path + ansible.builtin.lineinfile: + path: /etc/paths + state: present + line: '/opt/homebrew/bin' + become: true + become_user: root - name: 'add custom homebrew repos' community.general.homebrew_tap: @@ -26,35 +30,24 @@ ignore_errors: yes with_items: - 1password - - adoptopenjdk/openjdk/adoptopenjdk8 - android-sdk - android-studio - - dash - datagrip - docker - dropbox + - figma - google-chrome - google-cloud-sdk - - graphql-playground - iterm2 - kindle - - microsoft-office - ngrok - - osxfuse - - postico - - postman - - rstudio - - sketch - slack - sublime-text - telegram - - tunnelblick - - vagrant - - virtualbox - visual-studio-code - vlc - - zeplin - - zoomus + - zoom + - tuple - name: "Install homebrew packages" community.general.homebrew: @@ -69,7 +62,6 @@ 'dbt@0.18.0', 'direnv', 'dnsmasq', - 'erlang', 'fzf', 'gnu-time', 'gpg', @@ -83,23 +75,18 @@ 'libxslt', 'libyaml', 'mas', - 'mysql', 'openssl' , 'pkg-config', 'postgresql', - 'r', 'rcm', 'readline', 'redis', 'sqlite3', - 'sshfs', - 'terraform', 'tmux', 'unixodbc', 'unzip', 'vim', 'watchman', - 'weaveworks/tap/eksctl', 'xz', 'yarn', 'zlib', @@ -108,8 +95,10 @@ state: present update_homebrew: yes - - name: "Link ImageMagick6 as main version (for rmagick gem)" - shell: brew link -f imagemagick@6 + - name: "Install from Mac app store" + shell: mas install {{ item }} + with_items: + - 497799835 # xcode - name: Get the path to ZSH become: false @@ -143,15 +132,16 @@ src: templates/vscode-settings.json.j2 dest: /Users/{{ lookup('env', 'USER') }}/Library/Application Support/Code/User/settings.json owner: "{{ lookup('env', 'USER') }}" - force: no + force: yes - name: Create a default VSCode keuybinding configuration template: src: templates/vscode-keybindings.json.j2 dest: /Users/{{ lookup('env', 'USER') }}/Library/Application Support/Code/User/keybindings.json owner: "{{ lookup('env', 'USER') }}" - force: no + force: yes + # Add something which ensures path is set here - name: Install VSCode extensions shell: code --install-extension {{ item }} with_items: @@ -170,7 +160,6 @@ - richie5um2.vscode-sort-json - Tyriar.sort-lines - vscodevim.vim - - vscoss.vscode-ansible - wholroyd.jinja - wingrunr21.vscode-ruby - xabikos.javascriptsnippets @@ -180,7 +169,7 @@ - git: repo: https://github.com/asdf-vm/asdf.git dest: "/Users/{{ lookup('env', 'USER') }}/.asdf" - version: v0.7.1 + version: v0.8.1 - name: "Create a default asdf configuration" template: @@ -203,29 +192,17 @@ - name: "Install Default Python" shell: | source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh - asdf install python 3.9.1 - asdf global python 3.9.1 - pip3 install boto + asdf install python 3.10.0 + asdf global python 3.10.0 pip3 install ansible - pip3 install jupyterlab - pip3 isntall numpy - pip3 install scipy - pip3 install matplotlib - pip3 install ipython - pip3 install jupyter - pip3 install pandas - pip3 install sympy - pip3 install nose - pip3 install scikit-learn asdf reshim python - name: "Install Default Ruby" shell: | source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh - asdf install ruby 3.0.0 - asdf install ruby 2.7.2 - asdf global ruby 3.0.0 - gem install bundler -v 2.2.4 + asdf install ruby 3.0.2 + asdf global ruby 3.0.2 + gem install bundler gem install cocoapods gem install rubocop gem install solargraph @@ -234,51 +211,33 @@ shell: | source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh bash /Users/{{ lookup('env', 'USER') }}/.asdf/plugins/nodejs/bin/import-release-team-keyring - asdf install nodejs 14.15.3 - asdf global nodejs 14.15.3 + asdf install nodejs 16.4.2 + asdf global nodejs 16.4.2 + + - name: "Install default erlang" + shell: | + source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh + asdf install erlang 24.0.2 + asdf global erlang 24.0.2 + - name: "Install default elixir" shell: | source /Users/{{ lookup('env', 'USER') }}/.asdf/asdf.sh - asdf install elixir 1.11.2 - asdf global elixir 1.11.2 + asdf install elixir 1.12.3-otp-24 + asdf global elixir 1.12.3-otp-24 mix local.hex --force - mix archive.install hex phx_new 1.5.7 --force - name: Install yarn packages - shell: yarn global add {{ item }} --prefix /usr/local + shell: yarn global add {{ item }} with_items: - react-native-cli - create-react-app - apollo - generator-generator - yo + + - name: re-generate bins now we've installed some yarn packages + shell: asdf reshim nodejs + - - name: Install Addroid SDKs etc - shell: yes | sdkmanager "{{ item }}" --sdk_root=/Users/{{ lookup('env', 'USER') }}/Library/Android/sdk - with_items: - - "add-ons;addon-google_apis-google-21" - - "add-ons;addon-google_apis-google-22" - - "add-ons;addon-google_apis-google-23" - - "build-tools;23.0.1" - - "build-tools;23.0.3" - - "build-tools;25.0.2" - - "build-tools;25.0.3" - - "build-tools;26.0.0" - - "build-tools;26.0.1" - - "build-tools;26.0.2" - - "build-tools;26.0.3" - - "build-tools;27.0.3" - - "build-tools;28.0.3" - - "extras;android;m2repository" - - "extras;google;google_play_services" - - "extras;google;m2repository" - - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1" - - "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" - - "platforms;android-23" - - "platforms;android-25" - - "platforms;android-26" - - "platforms;android-27" - - "platforms;android-28" - - "system-images;android-23;google_apis;x86" - - "system-images;android-26;google_apis;x86" \ No newline at end of file diff --git a/bin/bootstrap b/bin/bootstrap index 54e7435..803ee7d 100755 --- a/bin/bootstrap +++ b/bin/bootstrap @@ -1,8 +1,10 @@ #!/bin/sh xcode-select --install sudo xcodebuild -license -sudo easy_install pip -pip install --ignore-installed ansible +/usr/sbin/softwareupdate --install-rosetta +curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py +python3 get-pip.py +sudo pip3 install --ignore-installed ansible ansible-galaxy install -r requirements.yml -ansible-playbook -i "localhost," -c local ansible_osx.yml --ask-become-pass \ No newline at end of file +ansible-playbook -i "localhost," -c local ansible_osx.yml --ask-become-pass diff --git a/requirements.yml b/requirements.yml index a17d037..62aa4a9 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,7 +1,6 @@ --- -roles: - - name: geerlingguy.homebrew collections: - name: https://github.com/ansible-collections/community.general.git type: git - version: main \ No newline at end of file + version: main + - name: geerlingguy.mac \ No newline at end of file diff --git a/templates/.zshrc.j2 b/templates/.zshrc.j2 index deaa89e..d08f3c8 100644 --- a/templates/.zshrc.j2 +++ b/templates/.zshrc.j2 @@ -7,12 +7,13 @@ export PATH=${PATH}:${ANDROID_HOME}/tools export PATH=${PATH}:${ANDROID_HOME}/platform-tools export PATH=/usr/local/opt/imagemagick@6/bin:${PATH} -# For compilers to find zlib you may need to set: -export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib" -export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include" +export optflags="-Wno-error=implicit-function-declaration" +export LDFLAGS="-L/opt/homebrew/opt/libffi/lib" +export CPPFLAGS="-I/opt/homebrew/opt/libffi/include" +export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" # For pkg-config to find zlib you may need to set: -export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig" +export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /opt/homebrew/opt/zlib/lib/pkgconfig" # ZSH setup export ZSH=$HOME/.oh-my-zsh