Skip to content

Commit

Permalink
Merge MR 'fix: make installation work again' into 'main'
Browse files Browse the repository at this point in the history
See merge request el-capitano/dotfiles!467
  • Loading branch information
tmeijn committed Jan 16, 2025
2 parents 72e4b34 + 28e2f0b commit 8378cab
Show file tree
Hide file tree
Showing 22 changed files with 336 additions and 157 deletions.
35 changes: 0 additions & 35 deletions NOTES.md

This file was deleted.

27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,27 @@ sh -c "$(wget -qO- get.chezmoi.io) -- init --apply --verbose tmeijn"
1. In a terminal, execute:

```bash
sh -c "$(wget -qO- get.chezmoi.io) -- init --apply --verbose --exclude scripts tmeijn"
sh -c "$(wget -qO- get.chezmoi.io) -- init --apply --exclude scripts tmeijn"
```

1. Close the terminal and open a new terminal and execute:
1. **Close the current terminal**
1. Open a new terminal and execute:

```bash
sh -c "$(wget -qO- get.chezmoi.io) -- init --apply --verbose tmeijn"
export ANSIBLE_PASSWORD="<YOUR_SUDO_PASSWORD>"
```

```bash
sh -c "$(wget -qO- get.chezmoi.io) -- init --apply tmeijn"
```

**note:** this might crash during installation. In that case open a new terminal and keep running `chezmoi apply`.

1. After reboot, unlock Bitwarden using `rbw unlock`
1. After reboot, open a terminal and unlock Bitwarden using our `reco` alias
1. Login to [`Atuin`](https://atuin.sh/):

```bash
atuin login -u zero-mass92 -p $(rbw get "Atuin Sync") -k "$(rbw get "Atuin Sync" -f Key)"
atuin login -u zero-mass92 -p $(rbw get "Atuin Sync") -k "$(rbw get "Atuin Sync" -f Key) && atuin sync"
```

1. Navigate to the chezmoi dir by executing `chezmoi cd`
Expand Down Expand Up @@ -71,7 +76,7 @@ In a terminal, get the Firefox Account Password by running:
rbw get "Firefox Account" | pbcopy
```

Open Firefox and open the top-right menu to enable sync.
Open a **new** Firefox window and open the top-right menu to enable sync.
You will be required to login, use your email and the password you just copied to your clipboard.
After logging in, all the Add-ons will be synced to the machine.

Expand All @@ -97,23 +102,23 @@ In the left sidebar, down left, login using your GitHub account. Everything shou

Open `Settings -> Online Accounts`. Click the Microsoft 365 account and add the following ID as tenant ID: `8ef61e06-9fd5-49af-9b63-6983aede4213`. [Source](https://gitlab.gnome.org/Infrastructure/Infrastructure/-/issues/1382). Note that this should no longer be needed once we run Gnome 47, which has this pre-configured.

NOTE: this does not work correctly with syncing back so we started using rclone. Document this before pushing this readme again. summary steps:

https://itsfoss.com/use-onedrive-linux-rclone/ Followed this guide.
Configure `rclone` by creating a Onedrive. This must have `onedrive` as the name to automatically mount on startup!

## Speedrun record 🏃

I try and re-install my system about every month while measuring how long it takes to set back up again.
Since this is on Ubuntu Asahi, I measure this from the point the OS is installed and a new user with my name has been set up.

Current record: **20:38:32** (- ~12min), set at 28-01-2024.
Current record: **20:38:32** (- ~12 minutes), set at 28-01-2024.

See [RUN_RECORDS.md](./RUN_RECORDS.md) for historical runs and more.

## Tools Used 🧰

Everything is managed by [`chezmoi`](https://www.chezmoi.io/).
The `run_once_` Bash scripts install all the tools we depend upon and actually manage the machine, namely:

- **Aqua**: [`aqua`](https://aquaproj.github.io/) is our entrypoint and actually installs Mise and a lot of other single-binary, zero dependency tools.
- **Aqua**: [`aqua`](https://aquaproj.github.io/) is our entrypoint and actually installs a lot of single-binary, zero dependency tools.
- **Mise**: [`mise`](https://mise.jdx.dev/) manages our more involved tools like Python, Node, Go, Rust, etc. See the [`config.toml`](chezmoi/dot_config/mise/config.toml) for all dependencies managed.
- **Ansible**: [Ansible](https://www.ansible.com/) manages our installed Applications using Flatpak, APT and sometimes a plain `.deb` file. See the [Ansible Playbook](ansible/setup.yaml) for more detailed information.

Expand Down
31 changes: 31 additions & 0 deletions RUN_RECORDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Run Records

## Template

```plain
## <DATE>
Completion time: `<mm:ss:ms>`
### Remarks
### Possible improvements
```

## 10-01-2025

Completion time: `27:05:25`

### Remarks

Actually went really smooth this time. Flatpaks and cargo installs take a really long time, but that was still 10 minutes or so. The reboot in the VM takes a really long time so certainly lost time there. Then there is the extension installation which just takes a bit of time and keeps shifting focus of the tab. Signing in to vscode opens LibreOffice Writer (WTF?!). Extension installation finally now is a good experience.

### Possible improvements

- ~~Open instructions in new window so it does not lose focus when settings up addons~~
- ~~Shorten reboot time~~
- ~~Preset `ANSIBLE_PASSWORD`~~
- ~~See if `gext` has a way to disable confirmation~~: not possible, see [issue](https://github.com/essembeh/gnome-extensions-cli/issues/13#issuecomment-1529160849)
- ~~Add instruction to explicitly sync Atuin~~
- ~~Check logins of the sites and maybe have priorities?~~: cleaned up logins, can't have priorities.
4 changes: 4 additions & 0 deletions chezmoi/.chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ args = [
"-c",
"cp {{ "{{ .Target }}" }} {{ "{{ .Target }}" }}.base && code --new-window --wait --merge {{ "{{ .Destination }}" }} {{ "{{ .Target }}" }} {{ "{{ .Target }}" }}.base {{ "{{ .Source }}" }}",
]

# This need to detect if we are interactive or in a script.
{{ if lookPath "diffnav" }}
[diff]
pager = "diffnav"
{{ end }}
11 changes: 11 additions & 0 deletions chezmoi/.chezmoiscripts/run_once_after_21_install-mise.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

echo ""
echo "==============================================================="
echo ""
echo "Installing Mise"
echo ""
echo "==============================================================="
echo ""

wget -qO- https://mise.run/ | sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

echo ""
echo "==============================================================="
echo ""
echo "Installing core dependencies with Ansible"
echo ""
echo "==============================================================="
echo ""

# ansible/tasks/install_core_packages.yaml hash: {{ include "ansible/tasks/install_core_packages.yaml" | sha256sum }}

sudo apt-get update

echo "Installing dependencies for building Python..."
sudo apt-get install -qq -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncurses-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

echo "Installing Git as Mise needs that as dependency"
sudo apt install git -y


mise install python
mise install pipx
mise install pipx:ansible[pipx_args="--include-deps"]

echo "Initializing mise..."
eval "$(mise env -s bash)"

ansible-playbook -v {{ joinPath .chezmoi.sourceDir "ansible/setup.yaml" | quote }} --tags core-packages
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,4 @@ echo ""
echo "==============================================================="
echo ""

echo "Installing Git as Mise needs that as dependency"
sudo apt install git -y

wget -qO- https://mise.run/ | sh

echo "Installing dependencies for building Python..."
sudo apt-get update
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

mise install --yes
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ echo ""
echo "Initializing mise..."
eval "$(mise env -s bash)"

# pipx does not automatically install the dependencies and therefore we cannot install it with mise.
pipx install --include-deps ansible

if [[ -v ANSIBLE_PASSWORD ]]; then
echo "ANSIBLE_PASSWORD set, becoming with value"
echo "debug: $ANSIBLE_PASSWORD"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ echo ""
echo "==============================================================="
echo ""

cat {{ joinPath .chezmoi.sourceDir "installed-extensions.txt" | quote }} | xargs -I {} gext install {}
echo "Initializing mise..."
eval "$(mise env -s bash)"

gext -D install $(cat {{ joinPath .chezmoi.sourceDir "installed-extensions.txt" | quote }} | tr '\n' ' ')

dconf load / < {{ joinPath .chezmoi.sourceDir "dconf.ini" | quote }}
4 changes: 2 additions & 2 deletions chezmoi/.chezmoiscripts/run_once_after_99_reboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ perform_reboot() {
reboot
}

echo "Rebooting in 30 seconds. Type 'x' and press Enter to cancel the reboot."
echo "Rebooting in 10 seconds. Type 'x' and press Enter to cancel the reboot."

for i in {30..1}; do
for i in {10..1}; do
echo -ne "\rRebooting in $i seconds... "

# Check for user input in the background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ if command -v ansible-playbook &> /dev/null; then
ansible-playbook -v {{ joinPath .chezmoi.sourceDir "ansible/setup.yaml" | quote }} --ask-become-pass
fi
fi

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ echo ""
# dconf.ini hash: {{ include "installed-extensions.txt" | sha256sum }}

if command -v gext &> /dev/null; then
cat {{ joinPath .chezmoi.sourceDir "installed-extensions.txt" | quote }} | xargs -I {} gext install {}
gext -D install $(cat {{ joinPath .chezmoi.sourceDir "installed-extensions.txt" | quote }} | tr '\n' ' ')
fi

73 changes: 16 additions & 57 deletions chezmoi/ansible/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
vscode_deb_url: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-arm64
when: ansible_architecture == 'aarch64'

- name: Install core packages
include_tasks:
file: tasks/install_core_packages.yaml
apply:
tags: [core-packages]
tags: [core-packages]

- name: Install packages
ansible.builtin.apt:
pkg:
Expand All @@ -42,6 +49,7 @@
- gtk2-engines-murrine
- jc
- kitty # Our terminal!
- lshw
- nala
- network-manager-l2tp
- network-manager-l2tp-gnome
Expand Down Expand Up @@ -83,14 +91,10 @@
community.general.flatpak:
name:
- org.videolan.VLC
- org.gnome.meld
- io.podman_desktop.PodmanDesktop
- org.flameshot.Flameshot
- io.dbeaver.DBeaverCommunity
- io.github.seadve.Kooha
- com.axosoft.GitKraken
- md.obsidian.Obsidian
- app.getclipboard.Clipboard
- dev.vencord.Vesktop
- com.moonlight_stream.Moonlight
state: present
Expand Down Expand Up @@ -175,22 +179,21 @@
- name: "[BLOCK] Add repo, install and configure Incus"
block:
- name: Add Incus's official GPG key
ansible.builtin.apt_key:
ansible.builtin.get_url:
url: https://pkgs.zabbly.com/key.asc
keyring: /etc/apt/keyrings/zabbly.asc
state: present
- name: Add Incus repository
ansible.builtin.apt_repository:
repo: >-
Enabled: yes
dest: /etc/apt/keyrings/zabbly.asc
# NOTE: hardcoded to noble as Incus does not do non-LTS releases
- name: Add Incus repository file
ansible.builtin.copy:
dest: "/etc/apt/sources.list.d/incus.sources"
content: |
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: noble
Components: main
Architectures: {{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
Signed-By: /etc/apt/keyrings/zabbly.asc
filename: incus
state: present
mode: '0644'
- name: Install Incus and related packages
ansible.builtin.apt:
pkg:
Expand All @@ -207,50 +210,6 @@
groups: incus-admin
append: true

# === NOTE: This is currently not working on Ubuntu Asahi
# - name: "[BLOCK] Add repo, install and configure Firefox"
# block:
# - name: Add Firefox's official GPG key
# ansible.builtin.apt_key:
# url: https://packages.mozilla.org/apt/repo-signing-key.gpg
# keyring: /etc/apt/keyrings/packages.mozilla.org.gpg
# state: absent
# - name: Add Firefox repository
# ansible.builtin.apt_repository:
# repo: >-
# deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.gpg]
# https://packages.mozilla.org/apt mozilla main
# filename: mozilla
# state: absent
# - name: Install Firefox
# ansible.builtin.apt:
# pkg:
# - firefox
# state: absent
# update_cache: true

# === NOTE: This is currently not working on Ubuntu Asahi
# - name: "[BLOCK] Add repo, install and configure Progressive Web Apps for Firefox"
# block:
# - name: ==== Add firefoxpwa's official GPG key
# ansible.builtin.apt_key:
# url: https://packagecloud.io/filips/FirefoxPWA/gpgkey
# keyring: /usr/share/keyrings/firefoxpwa-keyring.gpg
# state: absent
# - name: Add firefoxpwa repository
# ansible.builtin.apt_repository:
# repo: >-
# deb [signed-by=/usr/share/keyrings/firefoxpwa-keyring.gpg]
# https://packagecloud.io/filips/FirefoxPWA/any any main
# filename: firefoxpwa
# state: absent
# - name: Install Progressive Web Apps for Firefox
# ansible.builtin.apt:
# pkg:
# - firefoxpwa
# state: absent
# update_cache: true

# NOTE: this should be absolutely last as afterwards restart is needed.
- name: Install Pop Shell if not present
become: false
Expand Down
Loading

0 comments on commit 8378cab

Please sign in to comment.