mu
change
commit a733387d2e76e09ad0919da04b61de60462cdb26
author Alpha Chen <alpha.chen@brilliant.org>
date
parent d7293b86
diff --git a/.gitea/ISSUE_TEMPLATE.md b/.gitea/ISSUE_TEMPLATE.md
index 85ad716..feef3c2 100644
--- a/.gitea/ISSUE_TEMPLATE.md
+++ b/.gitea/ISSUE_TEMPLATE.md
@@ -1,3 +1,5 @@
+- [ ] Set computer name (System Settings -> General -> Sharing)
+
 - [ ] Install homebrew
 
   ```sh
@@ -13,13 +15,48 @@
 - [ ] Install bootstrapping tooling
 
   ```sh
-  brew install ansible
+  brew install 1password ansible
   ```
 
-- [ ] Clone dotfiles
+Set up 1Password, so that the SSH agent is already set up once ~/.gitconfig is
+in place.
+
+- [ ] Set up 1Password
+  - [ ] Set up the SSH agent
+  - [ ] Temporarily enable the 1Password identity agent in ~/.ssh/config
+
+- [ ] Grant Terminal.app full disk access (System Settings > Privacy & Security > Full Disk Access)
+
+- [ ] Clone setup repo
 
   ```sh
   mkdir ~/src
   git clone --recursive https://git.kejadlen.dev/alpha/boxen.git ~/src/boxen
   ```
 
+- [ ] Run Ansible
+
+  ```sh
+  ansible-playbook local/main.yml
+  ```
+
+- [ ] Install Neovim
+
+  ```sh
+  brew install tree-sitter --HEAD # sometimes needed
+  brew install neovim --HEAD
+  ```
+
+- [ ] Grant Ghostty full disk access (System Settings > Privacy & Security > Full Disk Access)
+
+# macOS things
+
+## Settings
+
+- [ ] Keyboard
+  - [ ] Remap ⇪ to ⌃ (Keyboard Shortcuts -> Modifier Keys)
+
+## Apps
+
+- [ ] Aerospace
+- [ ] Alfred
diff --git a/dev/bootstrap.sh b/dev/bootstrap.sh
deleted file mode 100755
index 2ad286a..0000000
--- a/dev/bootstrap.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# install homebrew
-/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
-export PATH=/opt/homebrew/bin:$PATH
-brew install ansible 1password 1password/tap/1password-cli
diff --git a/dev/dotfiles.yml b/dev/dotfiles.yml
deleted file mode 100644
index 0e03eb2..0000000
--- a/dev/dotfiles.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-- name: Sync dotfiles
-  hosts: dev
-  tasks:
-
-    - name: List dotfiles # noqa: risky-shell-pipe
-      ansible.builtin.shell: ls -A ~/.dotfiles | grep '^\.'
-      register: ls_dotfiles
-      changed_when: false
-
-    - name: Symlink dotfiles
-      ansible.builtin.file:
-        src: ~/.dotfiles/{{ item }}
-        dest: ~/{{ item }}
-        state: link
-      loop: "{{ ls_dotfiles.stdout_lines | difference(['.git', '.gitmodules', '.DS_Store']) }}"
-
-# vim: ft=yaml.ansible
diff --git a/dev/homebrew.yml b/dev/homebrew.yml
deleted file mode 100644
index c57766e..0000000
--- a/dev/homebrew.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-- name: Install homebrew formulae
-  hosts: os_MacOSX
-  tasks:
-
-  - name: Install Homebrew formulae
-    community.general.homebrew:
-      name: "{{ item }}"
-    loop:
-      - aerospace
-      - chruby
-      - difftastic
-      - direnv
-      - docker
-      - docker-compose
-      - efm-langserver
-      - entr
-      - eza
-      - fd
-      - fzf
-      - git
-      - git-lfs
-      - jj
-      - jq
-      - kitty
-      - luarocks
-      - pam-reattach
-      - restic
-      - ripgrep
-      - ruby-install
-      - shellcheck
-      - tmux
-      - tree
-      - yaml-language-server
-      - zoxide
-      - zsh
-
-      - felixkratz/formulae/sketchybar
-
-  - name: Install Homebrew formulae from HEAD
-    community.general.homebrew:
-      name: "{{ item }}"
-      state: head
-    loop:
-      - neovim
-
-  - name: Install Homebrew casks
-    community.general.homebrew_cask:
-      name: "{{ item }}"
-    loop:
-      - alfred
-      - fantastical
-      - firefox-developer-edition
-      - hammerspoon
-      - mailmate
-      - obsidian
-      - orbstack
-      - slack
-      - zoom
-
-      - font-source-code-pro
-      - font-symbols-only-nerd-font
-
-  - name: Heed docker-compose caveats
-    block:
-      - name: Create Docker CLI plugins config dir
-        ansible.builtin.file:
-          dest: ~/.docker/cli-plugins
-          state: directory
-
-# vim: ft=yaml.ansible
diff --git a/hosts.yml b/hosts.yml
index 342d40e..c2d311f 100644
--- a/hosts.yml
+++ b/hosts.yml
@@ -8,6 +8,9 @@ all:
       ansible_python_interpreter: /usr/bin/python3
     on-fire-within:
     lotus-land-story:
-dev:
+local:
+  hosts:
+    localhost:
+macos:
   hosts:
     localhost:
diff --git a/dev/defaults.yml b/local/defaults.yml
similarity index 94%
rename from dev/defaults.yml
rename to local/defaults.yml
index 53d0610..b77f850 100644
--- a/dev/defaults.yml
+++ b/local/defaults.yml
@@ -1,13 +1,14 @@
-- hosts: os_MacOSX
+- name: Update macOS defaults
+  hosts: macos
   tasks:
 
-  - name: set OS X defaults
+  - name: Set OS X defaults
     osx_defaults:
       domain: "{{ item.domain | default(omit) }}"
       key: "{{ item.key }}"
       type: "{{ item.type }}"
       value: "{{ item.value }}"
-    notify: restart OS X system services
+    notify: Restart OS X system services
     vars:
       mailmate:
         allowed_image_regexps:
@@ -20,7 +21,7 @@
           - wizardzines\.com
     with_items:
 
-    # NSGlobalDomain defaults
+      # NSGlobalDomain defaults
       - # don't quit idle applications
         domain: -g
         key: NSDisableAutomaticTermination
@@ -136,6 +137,12 @@
         key: autohide-delay
         type: float
         value: 0
+      - # https://nikitabobko.github.io/AeroSpace/guide#a-note-on-displays-have-separate-spaces
+        # disable "displays have separate spaces"
+        domain: com.apple.spaces
+        key: spans-displays
+        type: bool
+        value: true
 
       # Trackpad settings
       - domain: com.apple.driver.AppleBluetoothMultitouch.trackpad
@@ -267,7 +274,7 @@
 
   handlers:
 
-  - name: restart OS X system services
+  - name: Restart OS X system services
     command: killall {{ item }}
     with_items:
       - Finder
diff --git a/local/homebrew.yml b/local/homebrew.yml
new file mode 100644
index 0000000..bc6325a
--- /dev/null
+++ b/local/homebrew.yml
@@ -0,0 +1,92 @@
+- name: Install homebrew formulae
+  hosts: macos
+  tasks:
+
+    - name: Tap some Homebrews
+      community.general.homebrew_tap:
+        name: "{{ taps | join(',') }}"
+      vars:
+        taps:
+          - felixkratz/formulae
+          - nikitabobko/tap
+
+    - name: Install fonts
+      community.general.homebrew:
+        name: "{{ fonts | join(',') }}"
+      vars:
+        fonts:
+          - font-source-code-pro
+          - font-symbols-only-nerd-font
+
+    - name: Install Homebrew things
+      community.general.homebrew:
+        name: "{{ formulae | join(',') }}"
+      vars:
+        formulae:
+          - 1password-cli
+          - chruby
+          - difftastic
+          - direnv
+          - docker
+          - docker-compose
+          - efm-langserver
+          - entr
+          - eza
+          - fd
+          - fzf
+          - ghostty
+          - git
+          - git-lfs
+          - jj
+          - jq
+          - luarocks
+          - pam-reattach
+          - restic
+          - ripgrep
+          - ruby-install
+          - shellcheck
+          - tmux
+          - yaml-language-server
+          - zoxide
+          - zsh
+
+    - name: Install casks
+      community.general.homebrew_cask:
+        name: "{{ casks | join(',') }}"
+      vars:
+        casks:
+          - 1password
+          - aerospace
+          - alfred
+          - arc
+          - fantastical
+          - firefox@developer-edition
+          - hammerspoon
+          - mailmate
+          - obsidian
+          - orbstack
+          - slack
+          - tailscale
+          - zoom
+
+    # these doesn't work w/the ansible module for some reason
+
+    - name: Install sketchybar
+      command: brew install sketchybar
+      args:
+        creates: /opt/homebrew/bin/sketchybar
+      notify: Restart sketchybar
+
+    # handle caveats
+
+    - name: Create Docker CLI plugins config dir
+      ansible.builtin.file:
+        dest: ~/.docker/cli-plugins
+        state: directory
+
+  handlers:
+
+    - name: Restart sketchybar
+      command: brew services restart sketchybar
+
+# vim: ft=yaml.ansible
diff --git a/local/macos.yml b/local/macos.yml
new file mode 100644
index 0000000..d2ba4a5
--- /dev/null
+++ b/local/macos.yml
@@ -0,0 +1,27 @@
+- import_playbook: homebrew.yml
+- import_playbook: defaults.yml
+
+- name: Other macOS-specific things
+  hosts: macos
+  tasks:
+    - name: Symlink Jujutsu config
+      block:
+        - name: Register Jujutsu config location
+          ansible.builtin.command: jj config path --user
+          register: jj_config_path_user
+          changed_when: false
+
+        - name: Make sure Jujutsu config dir exists
+          ansible.builtin.file:
+            dest: "{{ path | dirname }}"
+            state: directory
+          vars:
+            path: "{{ jj_config_path_user.stdout }}"
+
+        - name: Symlink Jujutsu config
+          ansible.builtin.file:
+            src: ~/.config/jj/config.toml
+            dest: "{{ dest }}"
+            state: link
+          vars:
+            dest: "{{ jj_config_path_user.stdout }}"
diff --git a/local/main.yml b/local/main.yml
new file mode 100644
index 0000000..3fcca1e
--- /dev/null
+++ b/local/main.yml
@@ -0,0 +1,30 @@
+- name: Main playbook
+  hosts: local
+  tasks:
+
+    - name: Check out dotfiles
+      ansible.builtin.git:
+        repo: https://git.kejadlen.dev/alpha/dotfiles.git
+        dest: ~/.dotfiles
+        version: main
+        accept_newhostkey: true
+      # this repo often has local changes
+      ignore_errors: true # noqa: ignore-errors
+
+    - name: Symlink dotfiles
+      block:
+      - name: List dotfiles # noqa: risky-shell-pipe
+        ansible.builtin.shell: ls -A ~/.dotfiles | grep '^\.'
+        register: ls_dotfiles
+        changed_when: false
+
+      - name: Symlink dotfiles
+        ansible.builtin.file:
+          src: ~/.dotfiles/{{ item }}
+          dest: ~/{{ item }}
+          state: link
+        loop: "{{ ls_dotfiles.stdout_lines | difference(['.git', '.gitmodules', '.DS_Store']) }}"
+
+- import_playbook: macos.yml
+
+# vim: ft=yaml.ansible