migrate
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
---
|
||||
tags:
|
||||
- Desktop
|
||||
- GIT
|
||||
- Chezmoi
|
||||
---
|
||||
CHEZMOI
|
||||
|
||||
Now, just remember to always edit your dotfiles templates. Chezmoi give you some helpers:
|
||||
chezmoi cd # will cd you to the dotfiles repo directory to edit files, or use;
|
||||
chezmoi edit ~/.zshrc # will open the template in your editor
|
||||
|
||||
Whenever you change the template or the data file, just update everything:
|
||||
chezmoi update
|
||||
|
||||
push the changes to your repo:
|
||||
chezmoi cd
|
||||
git add .
|
||||
git commit -m "Update dotfiles"
|
||||
git push
|
||||
|
||||
|
||||
If you create new dotfiles, let's say you started to use Fish, then don't forget to add it to Chezmoi like this:
|
||||
chezmoi add --autotemplate ~/.fishrc
|
||||
|
||||
|
||||
You can use the convenience script to install the dotfiles on any machine with a single command. Simply run the following command in your terminal:
|
||||
export GITHUB_USERNAME=mmcfetridge1969
|
||||
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply $GITHUB_USERNAME
|
||||
|
||||
|
||||
Apply will install all the dependencies and add files to your $HOME.
|
||||
chezmoi apply
|
||||
|
||||
Update - From time to time, start the update simply with:
|
||||
chezmoi diff
|
||||
chezmoi update
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
- name: Check if the targeted version of flyctl is installed
|
||||
ansible.builtin.command: flyctl version
|
||||
register: installed_flyctl_version
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Download flyctl tar.gz
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/superfly/flyctl/releases/download/v{{ flyctl_version }}/flyctl_{{ flyctl_version }}_Linux_x86_64.tar.gz"
|
||||
dest: "/tmp/flyctl_{{ flyctl_version }}_Linux_x86_64.tar.gz"
|
||||
mode: "0644"
|
||||
when: flyctl_version not in installed_flyctl_version.stdout
|
||||
|
||||
- name: Extract flyctl to /usr/local/bin
|
||||
ansible.builtin.unarchive:
|
||||
src: "/tmp/flyctl_{{ flyctl_version }}_Linux_x86_64.tar.gz"
|
||||
dest: "/usr/local/bin"
|
||||
remote_src: true
|
||||
when: flyctl_version not in installed_flyctl_version.stdout
|
||||
|
||||
- name: Install Flatpak packages
|
||||
community.general.flatpak:
|
||||
name:
|
||||
- com.obsproject.Studio
|
||||
- org.videolan.VLC
|
||||
- org.tenacityaudio.Tenacity
|
||||
- md.obsidian.Obsidian
|
||||
- org.gimp.GIMP
|
||||
- rest.insomnia.Insomnia
|
||||
- com.github.johnfactotum.Foliate
|
||||
- org.gnome.meld
|
||||
- org.sqlitebrowser.sqlitebrowser
|
||||
state: present
|
||||
|
||||
- name: Ensure fonts directory
|
||||
ansible.builtin.file:
|
||||
path: "~{{ remote_regular_user }}/.fonts"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "{{ remote_regular_user }}"
|
||||
|
||||
- name: Check if Jetbrains Mono exists
|
||||
ansible.builtin.shell: "ls ~{{ remote_regular_user }}/.fonts/JetBrainsMonoNerd*FontMono*"
|
||||
register: jetbrains_mono_exists
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Download Jetbrains mono
|
||||
when: jetbrains_mono_exists is failed
|
||||
ansible.builtin.unarchive:
|
||||
src: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/JetBrainsMono.zip
|
||||
dest: "~{{ remote_regular_user }}/.fonts/"
|
||||
remote_src: true
|
||||
mode: "0755"
|
||||
owner: "{{ remote_regular_user }}"
|
||||
@@ -0,0 +1,273 @@
|
||||
CHEZMOI - ANSIBLE Sample file (Setup.yaml)
|
||||
|
||||
|
||||
|
||||
---
|
||||
- name: Machine setup
|
||||
hosts: localhost
|
||||
become: true
|
||||
remote_user: tmeijn
|
||||
connection: local
|
||||
gather_facts: true
|
||||
vars:
|
||||
teams_for_linux_version: "v1.4.37"
|
||||
arch_mapping: # Map ansible architecture {{ ansible_architecture }} names to Docker's architecture names
|
||||
x86_64: amd64
|
||||
aarch64: arm64
|
||||
|
||||
tasks:
|
||||
- name: Setting facts based on ansible_architecture
|
||||
block:
|
||||
- name: Set facts for amd64
|
||||
ansible.builtin.set_fact:
|
||||
aws_ssm_plugin_deb_url: https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb
|
||||
teams_for_linux_deb_url: https://github.com/IsmaelMartinez/teams-for-linux/releases/download/{{ teams_for_linux_version }}/teams-for-linux_{{ teams_for_linux_version | regex_replace('^v','') }}_amd64.deb
|
||||
vscode_deb_url: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64
|
||||
when: ansible_architecture == 'x86_64'
|
||||
|
||||
- name: Set facts for arm64
|
||||
ansible.builtin.set_fact:
|
||||
aws_ssm_plugin_deb_url: https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_arm64/session-manager-plugin.deb
|
||||
teams_for_linux_deb_url: https://github.com/IsmaelMartinez/teams-for-linux/releases/download/{{ teams_for_linux_version }}/teams-for-linux_{{ teams_for_linux_version | regex_replace('^v','') }}_arm64.deb
|
||||
vscode_deb_url: https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-arm64
|
||||
when: ansible_architecture == 'aarch64'
|
||||
|
||||
- name: Install packages
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- build-essential
|
||||
- curl
|
||||
- gawk
|
||||
- git
|
||||
- gnome-shell-extensions
|
||||
- gnome-tweaks
|
||||
- graphviz
|
||||
- gtk2-engines-murrine
|
||||
- incus
|
||||
- jc
|
||||
- kitty # Our terminal!
|
||||
- nala
|
||||
- network-manager-l2tp
|
||||
- network-manager-l2tp-gnome
|
||||
- pavucontrol
|
||||
- px
|
||||
- qemu-system
|
||||
- timeshift
|
||||
- vim
|
||||
- virt-manager
|
||||
- xclip
|
||||
|
||||
- name: Set Kitty as default
|
||||
ansible.builtin.shell: |
|
||||
sudo update-alternatives --set x-terminal-emulator "$(which kitty)"
|
||||
changed_when: false
|
||||
|
||||
- name: "[BLOCK] Setting up Flatpak"
|
||||
block:
|
||||
- name: Install Flatpak and dependencies if not present
|
||||
ansible.builtin.package:
|
||||
name:
|
||||
- flatpak
|
||||
- gnome-software-plugin-flatpak
|
||||
- name: Setup Flathub as a remote
|
||||
community.general.flatpak_remote:
|
||||
name: flathub
|
||||
state: present
|
||||
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
- name: Install Flatpak packages
|
||||
community.general.flatpak:
|
||||
name:
|
||||
- org.videolan.VLC
|
||||
- org.gnome.meld
|
||||
- io.podman_desktop.PodmanDesktop
|
||||
- org.flameshot.Flameshot
|
||||
- io.dbeaver.DBeaverCommunity
|
||||
# - org.chromium.Chromium
|
||||
- io.github.seadve.Kooha
|
||||
- com.axosoft.GitKraken
|
||||
- md.obsidian.Obsidian
|
||||
- app.getclipboard.Clipboard
|
||||
state: present
|
||||
|
||||
- name: Install Firefox as snap (arm64 is not available yet on Flatpak)
|
||||
community.general.snap:
|
||||
name: firefox
|
||||
|
||||
- name: "[BLOCK] Install AWS Session Manager Plugin if not present"
|
||||
block:
|
||||
- name: ==== Check if plugin is present
|
||||
become: false
|
||||
ansible.builtin.shell:
|
||||
cmd: command -v session-manager-plugin
|
||||
register: aws_ssm_plugin_installed
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: ==== Download Plugin
|
||||
ansible.builtin.apt:
|
||||
deb: "{{ aws_ssm_plugin_deb_url }}"
|
||||
state: present
|
||||
when: aws_ssm_plugin_installed is failed
|
||||
|
||||
- name: "[BLOCK] Install Visual Studio Code if not present"
|
||||
block:
|
||||
- name: ==== Check if VSCode is present
|
||||
become: false
|
||||
ansible.builtin.shell:
|
||||
cmd: command -v code
|
||||
register: vscode_installed
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: ==== Download VSCode
|
||||
ansible.builtin.apt:
|
||||
deb: "{{ vscode_deb_url }}"
|
||||
state: present
|
||||
when: vscode_installed is failed
|
||||
|
||||
- name: "[BLOCK] Install ble.sh if not present"
|
||||
block:
|
||||
- name: ==== Check if ble.sh is present
|
||||
become: false
|
||||
# noqa: command-instead-of-shell
|
||||
ansible.builtin.shell:
|
||||
cmd: command -v ble
|
||||
register: blesh_installed
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
- name: ==== Fetch ble.sh repository and install ble.sh
|
||||
become: false
|
||||
# noqa: command-instead-of-shell command-instead-of-module no-changed-when
|
||||
ansible.builtin.shell: |
|
||||
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
|
||||
make -C ble.sh install PREFIX=~/.local
|
||||
rm -rf ble.sh
|
||||
when: blesh_installed is failed
|
||||
|
||||
- name: "[BLOCK] Add repo, install and configure Docker"
|
||||
block:
|
||||
- name: Add Docker's official GPG key
|
||||
ansible.builtin.apt_key:
|
||||
url: https://download.docker.com/linux/ubuntu/gpg
|
||||
keyring: /etc/apt/keyrings/docker.gpg
|
||||
state: present
|
||||
- name: Add Docker repository
|
||||
ansible.builtin.apt_repository:
|
||||
repo: >-
|
||||
deb [arch={{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
|
||||
signed-by=/etc/apt/keyrings/docker.gpg]
|
||||
https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable
|
||||
filename: docker
|
||||
state: present
|
||||
- name: Install Docker and related packages
|
||||
ansible.builtin.apt:
|
||||
pkg:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
state: present
|
||||
update_cache: true
|
||||
- name: Add Docker group
|
||||
ansible.builtin.group:
|
||||
name: docker
|
||||
state: present
|
||||
- name: Add user to Docker group
|
||||
ansible.builtin.user:
|
||||
name: "{{ ansible_user }}"
|
||||
groups: docker
|
||||
append: true
|
||||
- name: Enable and start Docker services
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ item }}"
|
||||
enabled: true
|
||||
state: started
|
||||
loop:
|
||||
- docker.service
|
||||
- containerd.service
|
||||
|
||||
# === 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
|
||||
block:
|
||||
- name: Check if extension is present
|
||||
ansible.builtin.shell:
|
||||
cmd: gnome-extensions list | grep pop-shell@system76.com -q
|
||||
register: gnome_pop_shell_installed
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Download Plugin
|
||||
ansible.builtin.shell: |
|
||||
npm -g i typescript
|
||||
git clone --recursive --depth 1 --shallow-submodules --branch master_noble https://github.com/pop-os/shell.git
|
||||
cd shell
|
||||
make local-install
|
||||
cd ..
|
||||
rm -rf shell
|
||||
when: gnome_pop_shell_installed is failed
|
||||
|
||||
# - name: Ensure fonts directory
|
||||
# ansible.builtin.file:
|
||||
# path: "~{{ remote_regular_user }}/.fonts"
|
||||
# state: directory
|
||||
# mode: "0755"
|
||||
# owner: "{{ remote_regular_user }}"
|
||||
|
||||
# - name: Check if Jetbrains Mono exists
|
||||
# ansible.builtin.shell: "ls ~{{ remote_regular_user }}/.fonts/JetBrainsMonoNerd*FontMono*"
|
||||
# register: jetbrains_mono_exists
|
||||
# ignore_errors: true
|
||||
# changed_when: false
|
||||
|
||||
# - name: Download Jetbrains mono
|
||||
# when: jetbrains_mono_exists is failed
|
||||
# ansible.builtin.unarchive:
|
||||
# src: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/JetBrainsMono.zip
|
||||
# dest: "~{{ remote_regular_user }}/.fonts/"
|
||||
# remote_src: true
|
||||
# mode: "0755"
|
||||
# owner: "{{ remote_regular_user }}"
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
tags:
|
||||
- Chezmoi
|
||||
- Desktop
|
||||
---
|
||||
# dotfiles
|
||||
|
||||
This repo contains the configuration to setup my machines. This is using [Chezmoi](https://chezmoi.io), the dotfile manager to setup the install.
|
||||
|
||||
This automated setup is currently only configured for Fedora machines.
|
||||
|
||||
## How to run
|
||||
|
||||
```shell
|
||||
export GITHUB_USERNAME=logandonley
|
||||
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply $GITHUB_USERNAME
|
||||
```
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
---
|
||||
- name: Machine setup
|
||||
hosts: localhost
|
||||
become: true
|
||||
connection: local
|
||||
gather_facts: true
|
||||
vars:
|
||||
flyctl_version: "0.1.130"
|
||||
pulumi_version: "v3.94.2"
|
||||
|
||||
tasks:
|
||||
- name: Get my user
|
||||
ansible.builtin.set_fact:
|
||||
remote_regular_user: "{{ ansible_env.SUDO_USER or ansible_user_id }}"
|
||||
|
||||
- name: Install packages
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- git
|
||||
- htop
|
||||
- vim
|
||||
- firefox
|
||||
- gh
|
||||
- gnome-tweaks
|
||||
- gcc
|
||||
- helm
|
||||
- go-task
|
||||
- ripgrep
|
||||
- poetry
|
||||
- zsh
|
||||
- fzf
|
||||
- tmux
|
||||
- ffmpeg-free
|
||||
- zlib
|
||||
- zlib-devel
|
||||
- make
|
||||
- patch
|
||||
- bzip2
|
||||
- bzip2-devel
|
||||
- readline-devel
|
||||
- sqlite
|
||||
- sqlite-devel
|
||||
- openssl-devel
|
||||
- tk-devel
|
||||
- libffi-devel
|
||||
- xz-devel
|
||||
- libuuid-devel
|
||||
- gdbm-libs
|
||||
- libnsl2
|
||||
- luarocks
|
||||
- wl-clipboard
|
||||
- fd-find
|
||||
- gcc-c++
|
||||
- doctl
|
||||
- helix
|
||||
- "@Development Tools"
|
||||
- "@C Development Tools and Libraries"
|
||||
- autoconf
|
||||
- ncurses-devel
|
||||
- wxGTK-devel
|
||||
- wxBase
|
||||
- java-1.8.0-openjdk-devel
|
||||
- libiodbc
|
||||
- unixODBC-devel.x86_64
|
||||
- erlang-odbc.x86_64
|
||||
- libxslt
|
||||
- fop
|
||||
- podman-compose
|
||||
- inotify-tools
|
||||
- blender
|
||||
- toilet
|
||||
- dotnet-sdk-8.0
|
||||
- unar
|
||||
state: present
|
||||
|
||||
- name: Change shell to zsh
|
||||
ansible.builtin.user:
|
||||
name: "{{ remote_regular_user }}"
|
||||
shell: /usr/bin/zsh
|
||||
|
||||
- name: Add Brave Browser Repo
|
||||
ansible.builtin.yum_repository:
|
||||
name: brave-browser
|
||||
description: Brave Browser
|
||||
baseurl: https://brave-browser-rpm-release.s3.brave.com/x86_64/
|
||||
gpgkey: https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
|
||||
gpgcheck: true
|
||||
enabled: true
|
||||
|
||||
- name: Import Brave Browser GPG Key
|
||||
ansible.builtin.rpm_key:
|
||||
key: https://brave-browser-rpm-release.s3.brave.com/brave-core.asc
|
||||
state: present
|
||||
|
||||
- name: Install Brave Browser
|
||||
ansible.builtin.dnf:
|
||||
name: brave-browser
|
||||
state: present
|
||||
|
||||
- name: Import Microsoft GPG Key
|
||||
ansible.builtin.rpm_key:
|
||||
key: https://packages.microsoft.com/keys/microsoft.asc
|
||||
state: present
|
||||
|
||||
- name: Add Visual Studio Code Repo
|
||||
ansible.builtin.yum_repository:
|
||||
name: vscode
|
||||
description: Visual Studio Code
|
||||
baseurl: https://packages.microsoft.com/yumrepos/vscode
|
||||
gpgkey: https://packages.microsoft.com/keys/microsoft.asc
|
||||
gpgcheck: true
|
||||
enabled: true
|
||||
|
||||
- name: Install VS Code
|
||||
ansible.builtin.dnf:
|
||||
name: code
|
||||
state: present
|
||||
|
||||
- name: Add Docker repo
|
||||
ansible.builtin.yum_repository:
|
||||
name: docker
|
||||
description: Docker repo
|
||||
baseurl: "https://download.docker.com/linux/fedora/{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/stable"
|
||||
gpgkey: "https://download.docker.com/linux/fedora/gpg"
|
||||
gpgcheck: true
|
||||
enabled: true
|
||||
|
||||
- name: Install Docker
|
||||
ansible.builtin.dnf:
|
||||
name:
|
||||
- docker-ce
|
||||
- docker-ce-cli
|
||||
- containerd.io
|
||||
- docker-buildx-plugin
|
||||
- docker-compose-plugin
|
||||
state: present
|
||||
|
||||
- name: Add Docker group
|
||||
ansible.builtin.group:
|
||||
name: docker
|
||||
state: present
|
||||
|
||||
- name: Add user to docker group
|
||||
ansible.builtin.user:
|
||||
name: "{{ remote_regular_user }}"
|
||||
groups: docker
|
||||
append: true
|
||||
|
||||
- name: Add kubectl repo
|
||||
ansible.builtin.yum_repository:
|
||||
name: Kubernetes
|
||||
description: Kubernetes repo
|
||||
baseurl: https://pkgs.k8s.io/core:/stable:/v1.28/rpm/
|
||||
gpgkey: https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key
|
||||
gpgcheck: true
|
||||
enabled: true
|
||||
|
||||
- name: Install kubectl
|
||||
ansible.builtin.dnf:
|
||||
name: kubectl
|
||||
state: present
|
||||
|
||||
- name: Add Hashicorp Repo
|
||||
ansible.builtin.yum_repository:
|
||||
name: hashicorp
|
||||
description: Hashicorp repo
|
||||
baseurl: https://rpm.releases.hashicorp.com/fedora/$releasever/$basearch/stable
|
||||
gpgkey: https://rpm.releases.hashicorp.com/gpg
|
||||
gpgcheck: true
|
||||
enabled: true
|
||||
|
||||
- name: Install Terraform
|
||||
ansible.builtin.dnf:
|
||||
name: terraform
|
||||
state: present
|
||||
|
||||
- name: Check if Pulumi is installed
|
||||
ansible.builtin.command:
|
||||
cmd: pulumi version
|
||||
register: pulumi_installed
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Download Pulumi SDK
|
||||
ansible.builtin.get_url:
|
||||
url: "https://get.pulumi.com/releases/sdk/pulumi-{{ pulumi_version }}-linux-x64.tar.gz"
|
||||
dest: "/tmp/pulumi-{{ pulumi_version }}-linux-x64.tar.gz"
|
||||
mode: "0644"
|
||||
when: pulumi_installed is failed or pulumi_installed.stdout is not search(pulumi_version)
|
||||
|
||||
- name: Extract Pulumi to /usr/local/bin
|
||||
ansible.builtin.unarchive:
|
||||
src: "/tmp/pulumi-{{ pulumi_version }}-linux-x64.tar.gz"
|
||||
dest: /usr/local/bin
|
||||
extra_opts: [--strip-components=1]
|
||||
creates: /usr/local/bin/pulumi
|
||||
when: pulumi_installed is failed or pulumi_installed.stdout is not search(pulumi_version)
|
||||
|
||||
- name: Check if the targeted version of flyctl is installed
|
||||
ansible.builtin.command: flyctl version
|
||||
register: installed_flyctl_version
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Download flyctl tar.gz
|
||||
ansible.builtin.get_url:
|
||||
url: "https://github.com/superfly/flyctl/releases/download/v{{ flyctl_version }}/flyctl_{{ flyctl_version }}_Linux_x86_64.tar.gz"
|
||||
dest: "/tmp/flyctl_{{ flyctl_version }}_Linux_x86_64.tar.gz"
|
||||
mode: "0644"
|
||||
when: flyctl_version not in installed_flyctl_version.stdout
|
||||
|
||||
- name: Extract flyctl to /usr/local/bin
|
||||
ansible.builtin.unarchive:
|
||||
src: "/tmp/flyctl_{{ flyctl_version }}_Linux_x86_64.tar.gz"
|
||||
dest: "/usr/local/bin"
|
||||
remote_src: true
|
||||
when: flyctl_version not in installed_flyctl_version.stdout
|
||||
|
||||
- name: Install Flatpak packages
|
||||
community.general.flatpak:
|
||||
name:
|
||||
- com.obsproject.Studio
|
||||
- org.videolan.VLC
|
||||
- org.tenacityaudio.Tenacity
|
||||
- md.obsidian.Obsidian
|
||||
- org.gimp.GIMP
|
||||
- rest.insomnia.Insomnia
|
||||
- com.github.johnfactotum.Foliate
|
||||
- org.gnome.meld
|
||||
- org.sqlitebrowser.sqlitebrowser
|
||||
state: present
|
||||
|
||||
- name: Ensure fonts directory
|
||||
ansible.builtin.file:
|
||||
path: "~{{ remote_regular_user }}/.fonts"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
owner: "{{ remote_regular_user }}"
|
||||
|
||||
- name: Check if Jetbrains Mono exists
|
||||
ansible.builtin.shell: "ls ~{{ remote_regular_user }}/.fonts/JetBrainsMonoNerd*FontMono*"
|
||||
register: jetbrains_mono_exists
|
||||
ignore_errors: true
|
||||
changed_when: false
|
||||
|
||||
- name: Download Jetbrains mono
|
||||
when: jetbrains_mono_exists is failed
|
||||
ansible.builtin.unarchive:
|
||||
src: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/JetBrainsMono.zip
|
||||
dest: "~{{ remote_regular_user }}/.fonts/"
|
||||
remote_src: true
|
||||
mode: "0755"
|
||||
owner: "{{ remote_regular_user }}"
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[:b1dcc9dd-5262-4d8d-a863-c897e6d979b9]
|
||||
custom-command='zsh'
|
||||
font='JetBrainsMono Nerd Font 18'
|
||||
palette=['rgb(7,54,66)', 'rgb(220,50,47)', 'rgb(133,153,0)', 'rgb(181,137,0)', 'rgb(38,139,210)', 'rgb(211,54,130)', 'rgb(42,161,152)', 'rgb(238,232,213)', 'rgb(0,43,54)', 'rgb(203,75,22)', 'rgb(88,110,117)', 'rgb(101,123,131)', 'rgb(131,148,150)', 'rgb(108,113,196)', 'rgb(147,161,161)', 'rgb(253,246,227)']
|
||||
use-custom-command=true
|
||||
use-system-font=false
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
tags
|
||||
test.sh
|
||||
.luarc.json
|
||||
nvim
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
column_width = 160
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
call_parentheses = "None"
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
require("options")
|
||||
require("keymaps")
|
||||
require("lazy").setup("plugins")
|
||||
require("setup-lsp")
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "57c9f5c31b3d712376c704673eac8e948c82e9c1" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"copilot.lua": { "branch": "master", "commit": "dcaaed5b58e6c2d395bca18d25d34e6384856722" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "7b9c383438a2e490e37d57b07ddeae3ab4f4cf69" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "9031087ff1b18d0a34bd664719ec66cc8be1efd8" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9453e3d6cd2ca45d96e20f343e8f1b927364b630" },
|
||||
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "230ff118613fa07138ba579b89d13ec2201530b9" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "be6bf4f5d2d3b173c9291f074130a3d29e1af78a" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "ef09f14eab78ca6ce3bee1ddc73db5511f5cd953" },
|
||||
"nui.nvim": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "eb81c7ea08d6f01d5fa4cf09e58c708efadf9b2f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "24be1534dbd062907842601ae1e2e953ba02472e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ec1c5bdb3d87ac971749fa6c7dbc2b14884f1f6a" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a1425903ab52a0a0460622519e827f224e5b4fee" },
|
||||
"obsidian.nvim": { "branch": "main", "commit": "ce58193226fa72302ad0732aa61d6a4bec3f0789" },
|
||||
"oxocarbon.nvim": { "branch": "main", "commit": "c5846d10cbe4131cc5e32c6d00beaf59cb60f6a2" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
vim.keymap.set('n', '<leader>L', "<cmd>Lazy<CR>", { desc = 'Lazy' })
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = false
|
||||
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
|
||||
vim.o.breakindent = true
|
||||
|
||||
vim.o.undofile = true
|
||||
|
||||
vim.o.smartcase = true
|
||||
vim.o.hlsearch = false
|
||||
|
||||
vim.o.termguicolors = true
|
||||
|
||||
vim.o.completeopt = 'menuone,noselect'
|
||||
|
||||
vim.o.softtabstop = 2
|
||||
vim.o.tabstop = 2
|
||||
vim.o.smartindent = true
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.confirm = true
|
||||
vim.o.cursorline = true
|
||||
vim.o.expandtab = true
|
||||
|
||||
vim.o.linebreak = true
|
||||
|
||||
-- vim.wo.signcolumn = 'yes'
|
||||
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"windwp/nvim-ts-autotag",
|
||||
opts = {
|
||||
autotag = {
|
||||
enable = true,
|
||||
enable_rename = true,
|
||||
enable_close = true,
|
||||
enable_close_on_slash = true,
|
||||
}
|
||||
},
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
return { 'numToStr/Comment.nvim', opts = {} }
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
return {
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
build = ":Copilot auth",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
keymap = {
|
||||
accept = "<C-l>",
|
||||
},
|
||||
},
|
||||
panel = { enabled = false },
|
||||
filetypes = {
|
||||
markdown = true,
|
||||
yaml = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
return {
|
||||
'nvimdev/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = function()
|
||||
require('dashboard').setup {
|
||||
theme = 'hyper',
|
||||
config = {
|
||||
week_header = {
|
||||
enable = true,
|
||||
},
|
||||
shortcut = {
|
||||
{ desc = ' Update', group = '@property', action = 'Lazy update', key = 'u' },
|
||||
{
|
||||
icon = ' ',
|
||||
icon_hl = '@variable',
|
||||
desc = 'Files',
|
||||
group = 'Label',
|
||||
action = 'Telescope find_files',
|
||||
key = 'f',
|
||||
},
|
||||
{
|
||||
desc = ' dotfiles',
|
||||
group = 'Number',
|
||||
action = 'Telescope dotfiles',
|
||||
key = 'd',
|
||||
},
|
||||
{
|
||||
desc = ' obsidian',
|
||||
group = 'Number',
|
||||
action = 'Telescope find_files cwd=~/brain2',
|
||||
key = 'o',
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
end,
|
||||
dependencies = { { 'nvim-tree/nvim-web-devicons' } }
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
'j-hui/fidget.nvim',
|
||||
opts = {}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
return {
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function()
|
||||
local null_ls = require("null-ls")
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
local sources = {}
|
||||
sources[#sources + 1] = formatting.black
|
||||
|
||||
if vim.fn.executable("djlint") == 1 then
|
||||
sources[#sources + 1] = formatting.djlint.with({
|
||||
command = "djlint",
|
||||
args = { "--reformat", "-" },
|
||||
})
|
||||
end
|
||||
|
||||
sources[#sources + 1] = formatting.prettier
|
||||
sources[#sources + 1] = formatting.stylua
|
||||
sources[#sources + 1] = formatting.isort
|
||||
sources[#sources + 1] = diagnostics.flake8
|
||||
|
||||
|
||||
null_ls.setup({
|
||||
sources = sources,
|
||||
})
|
||||
end,
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require('harpoon')
|
||||
harpoon:setup()
|
||||
|
||||
vim.keymap.set("n", "<M-a>", function() harpoon:list():append() end)
|
||||
vim.keymap.set("n", "<M-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
|
||||
vim.keymap.set("n", "<M-j>", function() harpoon:list():select(1) end)
|
||||
vim.keymap.set("n", "<M-k>", function() harpoon:list():select(2) end)
|
||||
vim.keymap.set("n", "<M-l>", function() harpoon:list():select(3) end)
|
||||
vim.keymap.set("n", "<M-;>", function() harpoon:list():select(4) end)
|
||||
end,
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'folke/neodev.nvim',
|
||||
'hrsh7th/nvim-cmp',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
"rafamadriz/friendly-snippets"
|
||||
},
|
||||
lazy = true,
|
||||
config = false
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
opts = {
|
||||
theme = 'oxocarbon'
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
"folke/neodev.nvim",
|
||||
opts = {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v3.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>Neotree toggle<CR>", desc = "Neotree" }
|
||||
},
|
||||
opts = {
|
||||
window = {
|
||||
width = 30
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*",
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>os", "<cmd>ObsidianSearch<CR>", desc = "Obsidian search" },
|
||||
{ "<leader>on", "<cmd>ObsidianNew<CR>", desc = "Obsidian new" },
|
||||
{ "<leader>ot", "<cmd>ObsidianToday<CR>", desc = "Obsidian today" },
|
||||
{ "<leader>ol", "<cmd>ObsidianLink<CR>", desc = "Obsidian link" },
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "brain2",
|
||||
path = "~/brain2",
|
||||
},
|
||||
},
|
||||
templates = {
|
||||
subdir = "templates",
|
||||
date_format = "%Y-%m-%d",
|
||||
time_format = "%H:%M",
|
||||
},
|
||||
daily_notes = {
|
||||
folder = "daily",
|
||||
date_format = "%Y-%m-%d",
|
||||
alias_format = "%B %-d, %Y",
|
||||
template = 'daily.md'
|
||||
},
|
||||
},
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"nyoom-engineering/oxocarbon.nvim",
|
||||
config = function()
|
||||
vim.opt.background = "dark"
|
||||
vim.cmd.colorscheme "oxocarbon"
|
||||
end,
|
||||
priority = 1000,
|
||||
lazy = false
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.5',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.find_files, { desc = 'Find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Search buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Search helps' })
|
||||
vim.keymap.set('v', '<leader>fs', builtin.grep_string, { desc = 'Search selection' })
|
||||
vim.keymap.set('n', '<leader>fm', builtin.man_pages, { desc = 'Search man pages' })
|
||||
vim.keymap.set('n', '<leader>ft', builtin.filetypes, { desc = 'Search filetypes' })
|
||||
end
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
},
|
||||
config = function()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "javascript", "html", "css", "python", "go", "tsx", "bash", "markdown", "markdown_inline", "http", "json" },
|
||||
auto_install = true,
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = {}
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
local lspconfig = require('lspconfig')
|
||||
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
desc = 'LSP actions',
|
||||
callback = function(event)
|
||||
local opts = { buffer = event.buf }
|
||||
|
||||
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
||||
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
||||
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
||||
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
||||
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
||||
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
||||
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
||||
vim.keymap.set('n', '<leader>cr', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>cf', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
||||
vim.keymap.set('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||||
|
||||
vim.keymap.set('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>', opts)
|
||||
vim.keymap.set('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>', opts)
|
||||
vim.keymap.set('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>', opts)
|
||||
end
|
||||
})
|
||||
|
||||
local default_setup = function(server)
|
||||
lspconfig[server].setup({
|
||||
capabilities = lsp_capabilities,
|
||||
})
|
||||
end
|
||||
|
||||
require('mason').setup({})
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
tsserver = {},
|
||||
pyright = {},
|
||||
html = { filetypes = { 'html', 'twig', 'hbs' } },
|
||||
lua_ls = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
handlers = { default_setup },
|
||||
})
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
},
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert',
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- Enter key confirms completion item
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
|
||||
-- Ctrl + space triggers completion menu
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
. "$HOME/.cargo/env"
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
export PATH="$HOME/.luarocks/bin:$PATH"
|
||||
|
||||
|
||||
# Added by Toolbox App
|
||||
export PATH="$PATH:/home/ldonley/.local/share/JetBrains/Toolbox/scripts"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
bind | split-window -h
|
||||
bind - split-window -v
|
||||
bind h select-pane -L
|
||||
bind l select-pane -R
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
set -g mouse on
|
||||
set-option -g allow-rename off
|
||||
bind r source-file ~/.tmux.conf
|
||||
set-option -g history-limit 10000
|
||||
|
||||
# Resize panes
|
||||
bind -n M-H resize-pane -L 2
|
||||
bind -n M-J resize-pane -D 2
|
||||
bind -n M-K resize-pane -U 2
|
||||
bind -n M-L resize-pane -R 2
|
||||
|
||||
# panes
|
||||
set -g pane-border-style 'fg=color233 bg=color234'
|
||||
set -g pane-active-border-style 'bg=color234 fg=color46'
|
||||
|
||||
# status bar
|
||||
set -g status-position bottom
|
||||
set -g status-style 'bg=color233 fg=color15 dim'
|
||||
|
||||
# Fix the slow escape-time for vim
|
||||
set -sg escape-time 10
|
||||
|
||||
|
||||
# Setting up clipboard
|
||||
set-option -s set-clipboard off
|
||||
bind P paste-buffer
|
||||
bind-key -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind-key -T copy-mode-vi V send-keys -X rectangle-toggle
|
||||
unbind -T copy-mode-vi Enter
|
||||
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'wl-copy'
|
||||
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'wl-copy'
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl-copy'
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
install_on_fedora() {
|
||||
sudo dnf install -y ansible
|
||||
}
|
||||
|
||||
install_on_ubuntu() {
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ansible
|
||||
}
|
||||
|
||||
install_on_mac() {
|
||||
brew install ansible
|
||||
}
|
||||
|
||||
OS="$(uname -s)"
|
||||
case "${OS}" in
|
||||
Linux*)
|
||||
if [ -f /etc/fedora-release ]; then
|
||||
install_on_fedora
|
||||
elif [ -f /etc/lsb-release ]; then
|
||||
install_on_ubuntu
|
||||
else
|
||||
echo "Unsupported Linux distribution"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
Darwin*)
|
||||
install_on_mac
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported operating system: ${OS}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
ansible-playbook ~/.bootstrap/setup.yml --ask-become-pass
|
||||
|
||||
echo "Ansible installation complete."
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
||||
echo "Getting ohmyz.sh"
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended --keep-zshrc --skip-chsh
|
||||
else
|
||||
echo ".oh-my-zsh already found, skipping."
|
||||
fi
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install rust
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
|
||||
source $HOME/.cargo/env
|
||||
source ~/.profile
|
||||
|
||||
# Install cargo binstall
|
||||
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||
|
||||
# Install bob-nvim
|
||||
cargo binstall bob-nvim
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# .bootstrap/setup.yml hash: {{ include "dot_bootstrap/setup.yml" | sha256sum }}
|
||||
|
||||
if command -v ansible-playbook &> /dev/null; then
|
||||
ansible-playbook {{ joinPath .chezmoi.sourceDir "dot_bootstrap/setup.yml" | quote }} --ask-become-pass
|
||||
fi
|
||||
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
# .config/gnome-terminal-profiles.dconf hash: {{ include "dot_config/gnome-terminal-profiles.dconf" | sha256sum }}
|
||||
dconf load /org/gnome/terminal/legacy/profiles:/ < {{ joinPath .chezmoi.sourceDir "dot_config/gnome-terminal-profiles.dconf" | quote }}
|
||||
@@ -0,0 +1,9 @@
|
||||
# Install Airvpn Client (eddie)
|
||||
|
||||
curl -fsSL https://eddie.website/repository/keys/eddie_maintainer_gpg.key | sudo tee /usr/share/keyrings/eddie.website-keyring.asc > /dev/null
|
||||
|
||||
echo "deb [signed-by=/usr/share/keyrings/eddie.website-keyring.asc] http://eddie.website/repository/apt stable main" | sudo tee /etc/apt/sources.list.d/eddie.website.list
|
||||
|
||||
sudo apt update
|
||||
|
||||
sudo apt install eddie-ui
|
||||
@@ -0,0 +1,12 @@
|
||||
# Install EZA
|
||||
|
||||
sudo apt update
|
||||
|
||||
sudo apt install -y gpg
|
||||
|
||||
sudo mkdir -p /etc/apt/keyrings
|
||||
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo gpg --dearmor -o /etc/apt/keyrings/gierens.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gierens.gpg] http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
|
||||
sudo chmod 644 /etc/apt/keyrings/gierens.gpg /etc/apt/sources.list.d/gierens.list
|
||||
sudo apt update
|
||||
sudo apt install -y eza
|
||||
@@ -0,0 +1,7 @@
|
||||
# Install Starfish
|
||||
|
||||
curl -sS https://starship.rs/install.sh | sh
|
||||
|
||||
eval "$(starship init bash)"
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
@@ -0,0 +1,3 @@
|
||||
# Install trilium notes
|
||||
|
||||
flatpak install flathub com.github.zadam.trilium -y
|
||||
@@ -0,0 +1,734 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
# Docker Engine for Linux installation script.
|
||||
#
|
||||
# This script is intended as a convenient way to configure docker's package
|
||||
# repositories and to install Docker Engine, This script is not recommended
|
||||
# for production environments. Before running this script, make yourself familiar
|
||||
# with potential risks and limitations, and refer to the installation manual
|
||||
# at https://docs.docker.com/engine/install/ for alternative installation methods.
|
||||
#
|
||||
# The script:
|
||||
#
|
||||
# - Requires `root` or `sudo` privileges to run.
|
||||
# - Attempts to detect your Linux distribution and version and configure your
|
||||
# package management system for you.
|
||||
# - Doesn't allow you to customize most installation parameters.
|
||||
# - Installs dependencies and recommendations without asking for confirmation.
|
||||
# - Installs the latest stable release (by default) of Docker CLI, Docker Engine,
|
||||
# Docker Buildx, Docker Compose, containerd, and runc. When using this script
|
||||
# to provision a machine, this may result in unexpected major version upgrades
|
||||
# of these packages. Always test upgrades in a test environment before
|
||||
# deploying to your production systems.
|
||||
# - Isn't designed to upgrade an existing Docker installation. When using the
|
||||
# script to update an existing installation, dependencies may not be updated
|
||||
# to the expected version, resulting in outdated versions.
|
||||
#
|
||||
# Source code is available at https://github.com/docker/docker-install/
|
||||
#
|
||||
# Usage
|
||||
# ==============================================================================
|
||||
#
|
||||
# To install the latest stable versions of Docker CLI, Docker Engine, and their
|
||||
# dependencies:
|
||||
#
|
||||
# 1. download the script
|
||||
#
|
||||
# $ curl -fsSL https://get.docker.com -o install-docker.sh
|
||||
#
|
||||
# 2. verify the script's content
|
||||
#
|
||||
# $ cat install-docker.sh
|
||||
#
|
||||
# 3. run the script with --dry-run to verify the steps it executes
|
||||
#
|
||||
# $ sh install-docker.sh --dry-run
|
||||
#
|
||||
# 4. run the script either as root, or using sudo to perform the installation.
|
||||
#
|
||||
# $ sudo sh install-docker.sh
|
||||
#
|
||||
# Command-line options
|
||||
# ==============================================================================
|
||||
#
|
||||
# --version <VERSION>
|
||||
# Use the --version option to install a specific version, for example:
|
||||
#
|
||||
# $ sudo sh install-docker.sh --version 23.0
|
||||
#
|
||||
# --channel <stable|test>
|
||||
#
|
||||
# Use the --channel option to install from an alternative installation channel.
|
||||
# The following example installs the latest versions from the "test" channel,
|
||||
# which includes pre-releases (alpha, beta, rc):
|
||||
#
|
||||
# $ sudo sh install-docker.sh --channel test
|
||||
#
|
||||
# Alternatively, use the script at https://test.docker.com, which uses the test
|
||||
# channel as default.
|
||||
#
|
||||
# --mirror <Aliyun|AzureChinaCloud>
|
||||
#
|
||||
# Use the --mirror option to install from a mirror supported by this script.
|
||||
# Available mirrors are "Aliyun" (https://mirrors.aliyun.com/docker-ce), and
|
||||
# "AzureChinaCloud" (https://mirror.azure.cn/docker-ce), for example:
|
||||
#
|
||||
# $ sudo sh install-docker.sh --mirror AzureChinaCloud
|
||||
#
|
||||
# ==============================================================================
|
||||
|
||||
|
||||
# Git commit from https://github.com/docker/docker-install when
|
||||
# the script was uploaded (Should only be modified by upload job):
|
||||
SCRIPT_COMMIT_SHA="0d6f72e671ba87f7aa4c6991646a1a5b9f9dae84"
|
||||
|
||||
# strip "v" prefix if present
|
||||
VERSION="${VERSION#v}"
|
||||
|
||||
# The channel to install from:
|
||||
# * stable
|
||||
# * test
|
||||
DEFAULT_CHANNEL_VALUE="stable"
|
||||
if [ -z "$CHANNEL" ]; then
|
||||
CHANNEL=$DEFAULT_CHANNEL_VALUE
|
||||
fi
|
||||
|
||||
DEFAULT_DOWNLOAD_URL="https://download.docker.com"
|
||||
if [ -z "$DOWNLOAD_URL" ]; then
|
||||
DOWNLOAD_URL=$DEFAULT_DOWNLOAD_URL
|
||||
fi
|
||||
|
||||
DEFAULT_REPO_FILE="docker-ce.repo"
|
||||
if [ -z "$REPO_FILE" ]; then
|
||||
REPO_FILE="$DEFAULT_REPO_FILE"
|
||||
fi
|
||||
|
||||
mirror=''
|
||||
DRY_RUN=${DRY_RUN:-}
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--channel)
|
||||
CHANNEL="$2"
|
||||
shift
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=1
|
||||
;;
|
||||
--mirror)
|
||||
mirror="$2"
|
||||
shift
|
||||
;;
|
||||
--version)
|
||||
VERSION="${2#v}"
|
||||
shift
|
||||
;;
|
||||
--*)
|
||||
echo "Illegal option $1"
|
||||
;;
|
||||
esac
|
||||
shift $(( $# > 0 ? 1 : 0 ))
|
||||
done
|
||||
|
||||
case "$mirror" in
|
||||
Aliyun)
|
||||
DOWNLOAD_URL="https://mirrors.aliyun.com/docker-ce"
|
||||
;;
|
||||
AzureChinaCloud)
|
||||
DOWNLOAD_URL="https://mirror.azure.cn/docker-ce"
|
||||
;;
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
>&2 echo "unknown mirror '$mirror': use either 'Aliyun', or 'AzureChinaCloud'."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$CHANNEL" in
|
||||
stable|test)
|
||||
;;
|
||||
*)
|
||||
>&2 echo "unknown CHANNEL '$CHANNEL': use either stable or test."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# version_gte checks if the version specified in $VERSION is at least the given
|
||||
# SemVer (Maj.Minor[.Patch]), or CalVer (YY.MM) version.It returns 0 (success)
|
||||
# if $VERSION is either unset (=latest) or newer or equal than the specified
|
||||
# version, or returns 1 (fail) otherwise.
|
||||
#
|
||||
# examples:
|
||||
#
|
||||
# VERSION=23.0
|
||||
# version_gte 23.0 // 0 (success)
|
||||
# version_gte 20.10 // 0 (success)
|
||||
# version_gte 19.03 // 0 (success)
|
||||
# version_gte 26.1 // 1 (fail)
|
||||
version_gte() {
|
||||
if [ -z "$VERSION" ]; then
|
||||
return 0
|
||||
fi
|
||||
version_compare "$VERSION" "$1"
|
||||
}
|
||||
|
||||
# version_compare compares two version strings (either SemVer (Major.Minor.Path),
|
||||
# or CalVer (YY.MM) version strings. It returns 0 (success) if version A is newer
|
||||
# or equal than version B, or 1 (fail) otherwise. Patch releases and pre-release
|
||||
# (-alpha/-beta) are not taken into account
|
||||
#
|
||||
# examples:
|
||||
#
|
||||
# version_compare 23.0.0 20.10 // 0 (success)
|
||||
# version_compare 23.0 20.10 // 0 (success)
|
||||
# version_compare 20.10 19.03 // 0 (success)
|
||||
# version_compare 20.10 20.10 // 0 (success)
|
||||
# version_compare 19.03 20.10 // 1 (fail)
|
||||
version_compare() (
|
||||
set +x
|
||||
|
||||
yy_a="$(echo "$1" | cut -d'.' -f1)"
|
||||
yy_b="$(echo "$2" | cut -d'.' -f1)"
|
||||
if [ "$yy_a" -lt "$yy_b" ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ "$yy_a" -gt "$yy_b" ]; then
|
||||
return 0
|
||||
fi
|
||||
mm_a="$(echo "$1" | cut -d'.' -f2)"
|
||||
mm_b="$(echo "$2" | cut -d'.' -f2)"
|
||||
|
||||
# trim leading zeros to accommodate CalVer
|
||||
mm_a="${mm_a#0}"
|
||||
mm_b="${mm_b#0}"
|
||||
|
||||
if [ "${mm_a:-0}" -lt "${mm_b:-0}" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
)
|
||||
|
||||
is_dry_run() {
|
||||
if [ -z "$DRY_RUN" ]; then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
is_wsl() {
|
||||
case "$(uname -r)" in
|
||||
*microsoft* ) true ;; # WSL 2
|
||||
*Microsoft* ) true ;; # WSL 1
|
||||
* ) false;;
|
||||
esac
|
||||
}
|
||||
|
||||
is_darwin() {
|
||||
case "$(uname -s)" in
|
||||
*darwin* ) true ;;
|
||||
*Darwin* ) true ;;
|
||||
* ) false;;
|
||||
esac
|
||||
}
|
||||
|
||||
deprecation_notice() {
|
||||
distro=$1
|
||||
distro_version=$2
|
||||
echo
|
||||
printf "\033[91;1mDEPRECATION WARNING\033[0m\n"
|
||||
printf " This Linux distribution (\033[1m%s %s\033[0m) reached end-of-life and is no longer supported by this script.\n" "$distro" "$distro_version"
|
||||
echo " No updates or security fixes will be released for this distribution, and users are recommended"
|
||||
echo " to upgrade to a currently maintained version of $distro."
|
||||
echo
|
||||
printf "Press \033[1mCtrl+C\033[0m now to abort this script, or wait for the installation to continue."
|
||||
echo
|
||||
sleep 10
|
||||
}
|
||||
|
||||
get_distribution() {
|
||||
lsb_dist=""
|
||||
# Every system that we officially support has /etc/os-release
|
||||
if [ -r /etc/os-release ]; then
|
||||
lsb_dist="$(. /etc/os-release && echo "$ID")"
|
||||
fi
|
||||
# Returning an empty string here should be alright since the
|
||||
# case statements don't act unless you provide an actual value
|
||||
echo "$lsb_dist"
|
||||
}
|
||||
|
||||
echo_docker_as_nonroot() {
|
||||
if is_dry_run; then
|
||||
return
|
||||
fi
|
||||
if command_exists docker && [ -e /var/run/docker.sock ]; then
|
||||
(
|
||||
set -x
|
||||
$sh_c 'docker version'
|
||||
) || true
|
||||
fi
|
||||
|
||||
# intentionally mixed spaces and tabs here -- tabs are stripped by "<<-EOF", spaces are kept in the output
|
||||
echo
|
||||
echo "================================================================================"
|
||||
echo
|
||||
if version_gte "20.10"; then
|
||||
echo "To run Docker as a non-privileged user, consider setting up the"
|
||||
echo "Docker daemon in rootless mode for your user:"
|
||||
echo
|
||||
echo " dockerd-rootless-setuptool.sh install"
|
||||
echo
|
||||
echo "Visit https://docs.docker.com/go/rootless/ to learn about rootless mode."
|
||||
echo
|
||||
fi
|
||||
echo
|
||||
echo "To run the Docker daemon as a fully privileged service, but granting non-root"
|
||||
echo "users access, refer to https://docs.docker.com/go/daemon-access/"
|
||||
echo
|
||||
echo "WARNING: Access to the remote API on a privileged Docker daemon is equivalent"
|
||||
echo " to root access on the host. Refer to the 'Docker daemon attack surface'"
|
||||
echo " documentation for details: https://docs.docker.com/go/attack-surface/"
|
||||
echo
|
||||
echo "================================================================================"
|
||||
echo
|
||||
}
|
||||
|
||||
# Check if this is a forked Linux distro
|
||||
check_forked() {
|
||||
|
||||
# Check for lsb_release command existence, it usually exists in forked distros
|
||||
if command_exists lsb_release; then
|
||||
# Check if the `-u` option is supported
|
||||
set +e
|
||||
lsb_release -a -u > /dev/null 2>&1
|
||||
lsb_release_exit_code=$?
|
||||
set -e
|
||||
|
||||
# Check if the command has exited successfully, it means we're in a forked distro
|
||||
if [ "$lsb_release_exit_code" = "0" ]; then
|
||||
# Print info about current distro
|
||||
cat <<-EOF
|
||||
You're using '$lsb_dist' version '$dist_version'.
|
||||
EOF
|
||||
|
||||
# Get the upstream release info
|
||||
lsb_dist=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'id' | cut -d ':' -f 2 | tr -d '[:space:]')
|
||||
dist_version=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'codename' | cut -d ':' -f 2 | tr -d '[:space:]')
|
||||
|
||||
# Print info about upstream distro
|
||||
cat <<-EOF
|
||||
Upstream release is '$lsb_dist' version '$dist_version'.
|
||||
EOF
|
||||
else
|
||||
if [ -r /etc/debian_version ] && [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "raspbian" ]; then
|
||||
if [ "$lsb_dist" = "osmc" ]; then
|
||||
# OSMC runs Raspbian
|
||||
lsb_dist=raspbian
|
||||
else
|
||||
# We're Debian and don't even know it!
|
||||
lsb_dist=debian
|
||||
fi
|
||||
dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')"
|
||||
case "$dist_version" in
|
||||
12)
|
||||
dist_version="bookworm"
|
||||
;;
|
||||
11)
|
||||
dist_version="bullseye"
|
||||
;;
|
||||
10)
|
||||
dist_version="buster"
|
||||
;;
|
||||
9)
|
||||
dist_version="stretch"
|
||||
;;
|
||||
8)
|
||||
dist_version="jessie"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
do_install() {
|
||||
echo "# Executing docker install script, commit: $SCRIPT_COMMIT_SHA"
|
||||
|
||||
if command_exists docker; then
|
||||
cat >&2 <<-'EOF'
|
||||
Warning: the "docker" command appears to already exist on this system.
|
||||
|
||||
If you already have Docker installed, this script can cause trouble, which is
|
||||
why we're displaying this warning and provide the opportunity to cancel the
|
||||
installation.
|
||||
|
||||
If you installed the current Docker package using this script and are using it
|
||||
again to update Docker, you can safely ignore this message.
|
||||
|
||||
You may press Ctrl+C now to abort this script.
|
||||
EOF
|
||||
( set -x; sleep 20 )
|
||||
fi
|
||||
|
||||
user="$(id -un 2>/dev/null || true)"
|
||||
|
||||
sh_c='sh -c'
|
||||
if [ "$user" != 'root' ]; then
|
||||
if command_exists sudo; then
|
||||
sh_c='sudo -E sh -c'
|
||||
elif command_exists su; then
|
||||
sh_c='su -c'
|
||||
else
|
||||
cat >&2 <<-'EOF'
|
||||
Error: this installer needs the ability to run commands as root.
|
||||
We are unable to find either "sudo" or "su" available to make this happen.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_dry_run; then
|
||||
sh_c="echo"
|
||||
fi
|
||||
|
||||
# perform some very rudimentary platform detection
|
||||
lsb_dist=$( get_distribution )
|
||||
lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')"
|
||||
|
||||
if is_wsl; then
|
||||
echo
|
||||
echo "WSL DETECTED: We recommend using Docker Desktop for Windows."
|
||||
echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop/"
|
||||
echo
|
||||
cat >&2 <<-'EOF'
|
||||
|
||||
You may press Ctrl+C now to abort this script.
|
||||
EOF
|
||||
( set -x; sleep 20 )
|
||||
fi
|
||||
|
||||
case "$lsb_dist" in
|
||||
|
||||
ubuntu)
|
||||
if command_exists lsb_release; then
|
||||
dist_version="$(lsb_release --codename | cut -f2)"
|
||||
fi
|
||||
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then
|
||||
dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")"
|
||||
fi
|
||||
;;
|
||||
|
||||
debian|raspbian)
|
||||
dist_version="$(sed 's/\/.*//' /etc/debian_version | sed 's/\..*//')"
|
||||
case "$dist_version" in
|
||||
12)
|
||||
dist_version="bookworm"
|
||||
;;
|
||||
11)
|
||||
dist_version="bullseye"
|
||||
;;
|
||||
10)
|
||||
dist_version="buster"
|
||||
;;
|
||||
9)
|
||||
dist_version="stretch"
|
||||
;;
|
||||
8)
|
||||
dist_version="jessie"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
centos|rhel)
|
||||
if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then
|
||||
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
if command_exists lsb_release; then
|
||||
dist_version="$(lsb_release --release | cut -f2)"
|
||||
fi
|
||||
if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then
|
||||
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Check if this is a forked Linux distro
|
||||
check_forked
|
||||
|
||||
# Print deprecation warnings for distro versions that recently reached EOL,
|
||||
# but may still be commonly used (especially LTS versions).
|
||||
case "$lsb_dist.$dist_version" in
|
||||
centos.8|centos.7|rhel.7)
|
||||
deprecation_notice "$lsb_dist" "$dist_version"
|
||||
;;
|
||||
debian.buster|debian.stretch|debian.jessie)
|
||||
deprecation_notice "$lsb_dist" "$dist_version"
|
||||
;;
|
||||
raspbian.buster|raspbian.stretch|raspbian.jessie)
|
||||
deprecation_notice "$lsb_dist" "$dist_version"
|
||||
;;
|
||||
ubuntu.bionic|ubuntu.xenial|ubuntu.trusty)
|
||||
deprecation_notice "$lsb_dist" "$dist_version"
|
||||
;;
|
||||
ubuntu.mantic|ubuntu.lunar|ubuntu.kinetic|ubuntu.impish|ubuntu.hirsute|ubuntu.groovy|ubuntu.eoan|ubuntu.disco|ubuntu.cosmic)
|
||||
deprecation_notice "$lsb_dist" "$dist_version"
|
||||
;;
|
||||
fedora.*)
|
||||
if [ "$dist_version" -lt 39 ]; then
|
||||
deprecation_notice "$lsb_dist" "$dist_version"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Run setup for each distro accordingly
|
||||
case "$lsb_dist" in
|
||||
ubuntu|debian|raspbian)
|
||||
pre_reqs="ca-certificates curl"
|
||||
apt_repo="deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] $DOWNLOAD_URL/linux/$lsb_dist $dist_version $CHANNEL"
|
||||
(
|
||||
if ! is_dry_run; then
|
||||
set -x
|
||||
fi
|
||||
$sh_c 'apt-get update -qq >/dev/null'
|
||||
$sh_c "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pre_reqs >/dev/null"
|
||||
$sh_c 'install -m 0755 -d /etc/apt/keyrings'
|
||||
$sh_c "curl -fsSL \"$DOWNLOAD_URL/linux/$lsb_dist/gpg\" -o /etc/apt/keyrings/docker.asc"
|
||||
$sh_c "chmod a+r /etc/apt/keyrings/docker.asc"
|
||||
$sh_c "echo \"$apt_repo\" > /etc/apt/sources.list.d/docker.list"
|
||||
$sh_c 'apt-get update -qq >/dev/null'
|
||||
)
|
||||
pkg_version=""
|
||||
if [ -n "$VERSION" ]; then
|
||||
if is_dry_run; then
|
||||
echo "# WARNING: VERSION pinning is not supported in DRY_RUN"
|
||||
else
|
||||
# Will work for incomplete versions IE (17.12), but may not actually grab the "latest" if in the test channel
|
||||
pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/~ce~.*/g' | sed 's/-/.*/g')"
|
||||
search_command="apt-cache madison docker-ce | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3"
|
||||
pkg_version="$($sh_c "$search_command")"
|
||||
echo "INFO: Searching repository for VERSION '$VERSION'"
|
||||
echo "INFO: $search_command"
|
||||
if [ -z "$pkg_version" ]; then
|
||||
echo
|
||||
echo "ERROR: '$VERSION' not found amongst apt-cache madison results"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
if version_gte "18.09"; then
|
||||
search_command="apt-cache madison docker-ce-cli | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3"
|
||||
echo "INFO: $search_command"
|
||||
cli_pkg_version="=$($sh_c "$search_command")"
|
||||
fi
|
||||
pkg_version="=$pkg_version"
|
||||
fi
|
||||
fi
|
||||
(
|
||||
pkgs="docker-ce${pkg_version%=}"
|
||||
if version_gte "18.09"; then
|
||||
# older versions didn't ship the cli and containerd as separate packages
|
||||
pkgs="$pkgs docker-ce-cli${cli_pkg_version%=} containerd.io"
|
||||
fi
|
||||
if version_gte "20.10"; then
|
||||
pkgs="$pkgs docker-compose-plugin docker-ce-rootless-extras$pkg_version"
|
||||
fi
|
||||
if version_gte "23.0"; then
|
||||
pkgs="$pkgs docker-buildx-plugin"
|
||||
fi
|
||||
if ! is_dry_run; then
|
||||
set -x
|
||||
fi
|
||||
$sh_c "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq $pkgs >/dev/null"
|
||||
)
|
||||
echo_docker_as_nonroot
|
||||
exit 0
|
||||
;;
|
||||
centos|fedora|rhel)
|
||||
if command_exists dnf; then
|
||||
pkg_manager="dnf"
|
||||
pkg_manager_flags="--best"
|
||||
config_manager="dnf config-manager"
|
||||
enable_channel_flag="--set-enabled"
|
||||
disable_channel_flag="--set-disabled"
|
||||
pre_reqs="dnf-plugins-core"
|
||||
else
|
||||
pkg_manager="yum"
|
||||
pkg_manager_flags=""
|
||||
config_manager="yum-config-manager"
|
||||
enable_channel_flag="--enable"
|
||||
disable_channel_flag="--disable"
|
||||
pre_reqs="yum-utils"
|
||||
fi
|
||||
|
||||
if [ "$lsb_dist" = "fedora" ]; then
|
||||
pkg_suffix="fc$dist_version"
|
||||
else
|
||||
pkg_suffix="el"
|
||||
fi
|
||||
repo_file_url="$DOWNLOAD_URL/linux/$lsb_dist/$REPO_FILE"
|
||||
(
|
||||
if ! is_dry_run; then
|
||||
set -x
|
||||
fi
|
||||
$sh_c "$pkg_manager $pkg_manager_flags install -y -q $pre_reqs"
|
||||
$sh_c "$config_manager --add-repo $repo_file_url"
|
||||
|
||||
if [ "$CHANNEL" != "stable" ]; then
|
||||
$sh_c "$config_manager $disable_channel_flag 'docker-ce-*'"
|
||||
$sh_c "$config_manager $enable_channel_flag 'docker-ce-$CHANNEL'"
|
||||
fi
|
||||
$sh_c "$pkg_manager makecache"
|
||||
)
|
||||
pkg_version=""
|
||||
if [ -n "$VERSION" ]; then
|
||||
if is_dry_run; then
|
||||
echo "# WARNING: VERSION pinning is not supported in DRY_RUN"
|
||||
else
|
||||
pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/\\\\.ce.*/g' | sed 's/-/.*/g').*$pkg_suffix"
|
||||
search_command="$pkg_manager list --showduplicates docker-ce | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'"
|
||||
pkg_version="$($sh_c "$search_command")"
|
||||
echo "INFO: Searching repository for VERSION '$VERSION'"
|
||||
echo "INFO: $search_command"
|
||||
if [ -z "$pkg_version" ]; then
|
||||
echo
|
||||
echo "ERROR: '$VERSION' not found amongst $pkg_manager list results"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
if version_gte "18.09"; then
|
||||
# older versions don't support a cli package
|
||||
search_command="$pkg_manager list --showduplicates docker-ce-cli | grep '$pkg_pattern' | tail -1 | awk '{print \$2}'"
|
||||
cli_pkg_version="$($sh_c "$search_command" | cut -d':' -f 2)"
|
||||
fi
|
||||
# Cut out the epoch and prefix with a '-'
|
||||
pkg_version="-$(echo "$pkg_version" | cut -d':' -f 2)"
|
||||
fi
|
||||
fi
|
||||
(
|
||||
pkgs="docker-ce$pkg_version"
|
||||
if version_gte "18.09"; then
|
||||
# older versions didn't ship the cli and containerd as separate packages
|
||||
if [ -n "$cli_pkg_version" ]; then
|
||||
pkgs="$pkgs docker-ce-cli-$cli_pkg_version containerd.io"
|
||||
else
|
||||
pkgs="$pkgs docker-ce-cli containerd.io"
|
||||
fi
|
||||
fi
|
||||
if version_gte "20.10"; then
|
||||
pkgs="$pkgs docker-compose-plugin docker-ce-rootless-extras$pkg_version"
|
||||
fi
|
||||
if version_gte "23.0"; then
|
||||
pkgs="$pkgs docker-buildx-plugin"
|
||||
fi
|
||||
if ! is_dry_run; then
|
||||
set -x
|
||||
fi
|
||||
$sh_c "$pkg_manager $pkg_manager_flags install -y -q $pkgs"
|
||||
)
|
||||
echo_docker_as_nonroot
|
||||
exit 0
|
||||
;;
|
||||
sles)
|
||||
if [ "$(uname -m)" != "s390x" ]; then
|
||||
echo "Packages for SLES are currently only available for s390x"
|
||||
exit 1
|
||||
fi
|
||||
repo_file_url="$DOWNLOAD_URL/linux/$lsb_dist/$REPO_FILE"
|
||||
pre_reqs="ca-certificates curl libseccomp2 awk"
|
||||
(
|
||||
if ! is_dry_run; then
|
||||
set -x
|
||||
fi
|
||||
$sh_c "zypper install -y $pre_reqs"
|
||||
$sh_c "zypper addrepo $repo_file_url"
|
||||
if ! is_dry_run; then
|
||||
cat >&2 <<-'EOF'
|
||||
WARNING!!
|
||||
openSUSE repository (https://download.opensuse.org/repositories/security:/SELinux) will be enabled now.
|
||||
Do you wish to continue?
|
||||
You may press Ctrl+C now to abort this script.
|
||||
EOF
|
||||
( set -x; sleep 30 )
|
||||
fi
|
||||
opensuse_repo="https://download.opensuse.org/repositories/security:/SELinux/openSUSE_Factory/security:SELinux.repo"
|
||||
$sh_c "zypper addrepo $opensuse_repo"
|
||||
$sh_c "zypper --gpg-auto-import-keys refresh"
|
||||
$sh_c "zypper lr -d"
|
||||
)
|
||||
pkg_version=""
|
||||
if [ -n "$VERSION" ]; then
|
||||
if is_dry_run; then
|
||||
echo "# WARNING: VERSION pinning is not supported in DRY_RUN"
|
||||
else
|
||||
pkg_pattern="$(echo "$VERSION" | sed 's/-ce-/\\\\.ce.*/g' | sed 's/-/.*/g')"
|
||||
search_command="zypper search -s --match-exact 'docker-ce' | grep '$pkg_pattern' | tail -1 | awk '{print \$6}'"
|
||||
pkg_version="$($sh_c "$search_command")"
|
||||
echo "INFO: Searching repository for VERSION '$VERSION'"
|
||||
echo "INFO: $search_command"
|
||||
if [ -z "$pkg_version" ]; then
|
||||
echo
|
||||
echo "ERROR: '$VERSION' not found amongst zypper list results"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
search_command="zypper search -s --match-exact 'docker-ce-cli' | grep '$pkg_pattern' | tail -1 | awk '{print \$6}'"
|
||||
# It's okay for cli_pkg_version to be blank, since older versions don't support a cli package
|
||||
cli_pkg_version="$($sh_c "$search_command")"
|
||||
pkg_version="-$pkg_version"
|
||||
fi
|
||||
fi
|
||||
(
|
||||
pkgs="docker-ce$pkg_version"
|
||||
if version_gte "18.09"; then
|
||||
if [ -n "$cli_pkg_version" ]; then
|
||||
# older versions didn't ship the cli and containerd as separate packages
|
||||
pkgs="$pkgs docker-ce-cli-$cli_pkg_version containerd.io"
|
||||
else
|
||||
pkgs="$pkgs docker-ce-cli containerd.io"
|
||||
fi
|
||||
fi
|
||||
if version_gte "20.10"; then
|
||||
pkgs="$pkgs docker-compose-plugin docker-ce-rootless-extras$pkg_version"
|
||||
fi
|
||||
if version_gte "23.0"; then
|
||||
pkgs="$pkgs docker-buildx-plugin"
|
||||
fi
|
||||
if ! is_dry_run; then
|
||||
set -x
|
||||
fi
|
||||
$sh_c "zypper -q install -y $pkgs"
|
||||
)
|
||||
echo_docker_as_nonroot
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
if [ -z "$lsb_dist" ]; then
|
||||
if is_darwin; then
|
||||
echo
|
||||
echo "ERROR: Unsupported operating system 'macOS'"
|
||||
echo "Please get Docker Desktop from https://www.docker.com/products/docker-desktop"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
echo "ERROR: Unsupported distribution '$lsb_dist'"
|
||||
echo
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit 1
|
||||
}
|
||||
|
||||
# wrapped up in a function so that we have some protection against only getting
|
||||
# half the file during "curl | sh"
|
||||
do_install
|
||||
sudo usermod -aG docker $USER
|
||||
@@ -0,0 +1,556 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script should be run via curl:
|
||||
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
# or via wget:
|
||||
# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
# or via fetch:
|
||||
# sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
#
|
||||
# As an alternative, you can first download the install script and run it afterwards:
|
||||
# wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||
# sh install.sh
|
||||
#
|
||||
# You can tweak the install behavior by setting variables when running the script. For
|
||||
# example, to change the path to the Oh My Zsh repository:
|
||||
# ZSH=~/.zsh sh install.sh
|
||||
#
|
||||
# Respects the following environment variables:
|
||||
# ZDOTDIR - path to Zsh dotfiles directory (default: unset). See [1][2]
|
||||
# [1] https://zsh.sourceforge.io/Doc/Release/Parameters.html#index-ZDOTDIR
|
||||
# [2] https://zsh.sourceforge.io/Doc/Release/Files.html#index-ZDOTDIR_002c-use-of
|
||||
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
|
||||
# REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
|
||||
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
|
||||
# BRANCH - branch to check out immediately after install (default: master)
|
||||
#
|
||||
# Other options:
|
||||
# CHSH - 'no' means the installer will not change the default shell (default: yes)
|
||||
# RUNZSH - 'no' means the installer will not run zsh after the install (default: yes)
|
||||
# KEEP_ZSHRC - 'yes' means the installer will not replace an existing .zshrc (default: no)
|
||||
#
|
||||
# You can also pass some arguments to the install script to set some these options:
|
||||
# --skip-chsh: has the same behavior as setting CHSH to 'no'
|
||||
# --unattended: sets both CHSH and RUNZSH to 'no'
|
||||
# --keep-zshrc: sets KEEP_ZSHRC to 'yes'
|
||||
# For example:
|
||||
# sh install.sh --unattended
|
||||
# or:
|
||||
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||
#
|
||||
set -e
|
||||
|
||||
# Make sure important variables exist if not already defined
|
||||
#
|
||||
# $USER is defined by login(1) which is not always executed (e.g. containers)
|
||||
# POSIX: https://pubs.opengroup.org/onlinepubs/009695299/utilities/id.html
|
||||
USER=${USER:-$(id -u -n)}
|
||||
# $HOME is defined at the time of login, but it could be unset. If it is unset,
|
||||
# a tilde by itself (~) will not be expanded to the current user's home directory.
|
||||
# POSIX: https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap08.html#tag_08_03
|
||||
HOME="${HOME:-$(getent passwd $USER 2>/dev/null | cut -d: -f6)}"
|
||||
# macOS does not have getent, but this works even if $HOME is unset
|
||||
HOME="${HOME:-$(eval echo ~$USER)}"
|
||||
|
||||
|
||||
# Track if $ZSH was provided
|
||||
custom_zsh=${ZSH:+yes}
|
||||
|
||||
# Use $zdot to keep track of where the directory is for zsh dotfiles
|
||||
# To check if $ZDOTDIR was provided, explicitly check for $ZDOTDIR
|
||||
zdot="${ZDOTDIR:-$HOME}"
|
||||
|
||||
# Default value for $ZSH
|
||||
# a) if $ZDOTDIR is supplied and not $HOME: $ZDOTDIR/ohmyzsh
|
||||
# b) otherwise, $HOME/.oh-my-zsh
|
||||
if [ -n "$ZDOTDIR" ] && [ "$ZDOTDIR" != "$HOME" ]; then
|
||||
ZSH="${ZSH:-$ZDOTDIR/ohmyzsh}"
|
||||
fi
|
||||
ZSH="${ZSH:-$HOME/.oh-my-zsh}"
|
||||
|
||||
# Default settings
|
||||
REPO=${REPO:-ohmyzsh/ohmyzsh}
|
||||
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
|
||||
BRANCH=${BRANCH:-master}
|
||||
|
||||
# Other options
|
||||
CHSH=${CHSH:-yes}
|
||||
RUNZSH=${RUNZSH:-yes}
|
||||
KEEP_ZSHRC=${KEEP_ZSHRC:-no}
|
||||
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
user_can_sudo() {
|
||||
# Check if sudo is installed
|
||||
command_exists sudo || return 1
|
||||
# Termux can't run sudo, so we can detect it and exit the function early.
|
||||
case "$PREFIX" in
|
||||
*com.termux*) return 1 ;;
|
||||
esac
|
||||
# The following command has 3 parts:
|
||||
#
|
||||
# 1. Run `sudo` with `-v`. Does the following:
|
||||
# • with privilege: asks for a password immediately.
|
||||
# • without privilege: exits with error code 1 and prints the message:
|
||||
# Sorry, user <username> may not run sudo on <hostname>
|
||||
#
|
||||
# 2. Pass `-n` to `sudo` to tell it to not ask for a password. If the
|
||||
# password is not required, the command will finish with exit code 0.
|
||||
# If one is required, sudo will exit with error code 1 and print the
|
||||
# message:
|
||||
# sudo: a password is required
|
||||
#
|
||||
# 3. Check for the words "may not run sudo" in the output to really tell
|
||||
# whether the user has privileges or not. For that we have to make sure
|
||||
# to run `sudo` in the default locale (with `LANG=`) so that the message
|
||||
# stays consistent regardless of the user's locale.
|
||||
#
|
||||
! LANG= sudo -n -v 2>&1 | grep -q "may not run sudo"
|
||||
}
|
||||
|
||||
# The [ -t 1 ] check only works when the function is not called from
|
||||
# a subshell (like in `$(...)` or `(...)`, so this hack redefines the
|
||||
# function at the top level to always return false when stdout is not
|
||||
# a tty.
|
||||
if [ -t 1 ]; then
|
||||
is_tty() {
|
||||
true
|
||||
}
|
||||
else
|
||||
is_tty() {
|
||||
false
|
||||
}
|
||||
fi
|
||||
|
||||
# This function uses the logic from supports-hyperlinks[1][2], which is
|
||||
# made by Kat Marchán (@zkat) and licensed under the Apache License 2.0.
|
||||
# [1] https://github.com/zkat/supports-hyperlinks
|
||||
# [2] https://crates.io/crates/supports-hyperlinks
|
||||
#
|
||||
# Copyright (c) 2021 Kat Marchán
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
supports_hyperlinks() {
|
||||
# $FORCE_HYPERLINK must be set and be non-zero (this acts as a logic bypass)
|
||||
if [ -n "$FORCE_HYPERLINK" ]; then
|
||||
[ "$FORCE_HYPERLINK" != 0 ]
|
||||
return $?
|
||||
fi
|
||||
|
||||
# If stdout is not a tty, it doesn't support hyperlinks
|
||||
is_tty || return 1
|
||||
|
||||
# DomTerm terminal emulator (domterm.org)
|
||||
if [ -n "$DOMTERM" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# VTE-based terminals above v0.50 (Gnome Terminal, Guake, ROXTerm, etc)
|
||||
if [ -n "$VTE_VERSION" ]; then
|
||||
[ $VTE_VERSION -ge 5000 ]
|
||||
return $?
|
||||
fi
|
||||
|
||||
# If $TERM_PROGRAM is set, these terminals support hyperlinks
|
||||
case "$TERM_PROGRAM" in
|
||||
Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
|
||||
esac
|
||||
|
||||
# These termcap entries support hyperlinks
|
||||
case "$TERM" in
|
||||
xterm-kitty|alacritty|alacritty-direct) return 0 ;;
|
||||
esac
|
||||
|
||||
# xfce4-terminal supports hyperlinks
|
||||
if [ "$COLORTERM" = "xfce4-terminal" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Windows Terminal also supports hyperlinks
|
||||
if [ -n "$WT_SESSION" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Konsole supports hyperlinks, but it's an opt-in setting that can't be detected
|
||||
# https://github.com/ohmyzsh/ohmyzsh/issues/10964
|
||||
# if [ -n "$KONSOLE_VERSION" ]; then
|
||||
# return 0
|
||||
# fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# Adapted from code and information by Anton Kochkov (@XVilka)
|
||||
# Source: https://gist.github.com/XVilka/8346728
|
||||
supports_truecolor() {
|
||||
case "$COLORTERM" in
|
||||
truecolor|24bit) return 0 ;;
|
||||
esac
|
||||
|
||||
case "$TERM" in
|
||||
iterm |\
|
||||
tmux-truecolor |\
|
||||
linux-truecolor |\
|
||||
xterm-truecolor |\
|
||||
screen-truecolor) return 0 ;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
fmt_link() {
|
||||
# $1: text, $2: url, $3: fallback mode
|
||||
if supports_hyperlinks; then
|
||||
printf '\033]8;;%s\033\\%s\033]8;;\033\\\n' "$2" "$1"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$3" in
|
||||
--text) printf '%s\n' "$1" ;;
|
||||
--url|*) fmt_underline "$2" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
fmt_underline() {
|
||||
is_tty && printf '\033[4m%s\033[24m\n' "$*" || printf '%s\n' "$*"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2016 # backtick in single-quote
|
||||
fmt_code() {
|
||||
is_tty && printf '`\033[2m%s\033[22m`\n' "$*" || printf '`%s`\n' "$*"
|
||||
}
|
||||
|
||||
fmt_error() {
|
||||
printf '%sError: %s%s\n' "${FMT_BOLD}${FMT_RED}" "$*" "$FMT_RESET" >&2
|
||||
}
|
||||
|
||||
setup_color() {
|
||||
# Only use colors if connected to a terminal
|
||||
if ! is_tty; then
|
||||
FMT_RAINBOW=""
|
||||
FMT_RED=""
|
||||
FMT_GREEN=""
|
||||
FMT_YELLOW=""
|
||||
FMT_BLUE=""
|
||||
FMT_BOLD=""
|
||||
FMT_RESET=""
|
||||
return
|
||||
fi
|
||||
|
||||
if supports_truecolor; then
|
||||
FMT_RAINBOW="
|
||||
$(printf '\033[38;2;255;0;0m')
|
||||
$(printf '\033[38;2;255;97;0m')
|
||||
$(printf '\033[38;2;247;255;0m')
|
||||
$(printf '\033[38;2;0;255;30m')
|
||||
$(printf '\033[38;2;77;0;255m')
|
||||
$(printf '\033[38;2;168;0;255m')
|
||||
$(printf '\033[38;2;245;0;172m')
|
||||
"
|
||||
else
|
||||
FMT_RAINBOW="
|
||||
$(printf '\033[38;5;196m')
|
||||
$(printf '\033[38;5;202m')
|
||||
$(printf '\033[38;5;226m')
|
||||
$(printf '\033[38;5;082m')
|
||||
$(printf '\033[38;5;021m')
|
||||
$(printf '\033[38;5;093m')
|
||||
$(printf '\033[38;5;163m')
|
||||
"
|
||||
fi
|
||||
|
||||
FMT_RED=$(printf '\033[31m')
|
||||
FMT_GREEN=$(printf '\033[32m')
|
||||
FMT_YELLOW=$(printf '\033[33m')
|
||||
FMT_BLUE=$(printf '\033[34m')
|
||||
FMT_BOLD=$(printf '\033[1m')
|
||||
FMT_RESET=$(printf '\033[0m')
|
||||
}
|
||||
|
||||
setup_ohmyzsh() {
|
||||
# Prevent the cloned repository from having insecure permissions. Failing to do
|
||||
# so causes compinit() calls to fail with "command not found: compdef" errors
|
||||
# for users with insecure umasks (e.g., "002", allowing group writability). Note
|
||||
# that this will be ignored under Cygwin by default, as Windows ACLs take
|
||||
# precedence over umasks except for filesystems mounted with option "noacl".
|
||||
umask g-w,o-w
|
||||
|
||||
echo "${FMT_BLUE}Cloning Oh My Zsh...${FMT_RESET}"
|
||||
|
||||
command_exists git || {
|
||||
fmt_error "git is not installed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ostype=$(uname)
|
||||
if [ -z "${ostype%CYGWIN*}" ] && git --version | grep -Eq 'msysgit|windows'; then
|
||||
fmt_error "Windows/MSYS Git is not supported on Cygwin"
|
||||
fmt_error "Make sure the Cygwin git package is installed and is first on the \$PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Manual clone with git config options to support git < v1.7.2
|
||||
git init --quiet "$ZSH" && cd "$ZSH" \
|
||||
&& git config core.eol lf \
|
||||
&& git config core.autocrlf false \
|
||||
&& git config fsck.zeroPaddedFilemode ignore \
|
||||
&& git config fetch.fsck.zeroPaddedFilemode ignore \
|
||||
&& git config receive.fsck.zeroPaddedFilemode ignore \
|
||||
&& git config oh-my-zsh.remote origin \
|
||||
&& git config oh-my-zsh.branch "$BRANCH" \
|
||||
&& git remote add origin "$REMOTE" \
|
||||
&& git fetch --depth=1 origin \
|
||||
&& git checkout -b "$BRANCH" "origin/$BRANCH" || {
|
||||
[ ! -d "$ZSH" ] || {
|
||||
cd -
|
||||
rm -rf "$ZSH" 2>/dev/null
|
||||
}
|
||||
fmt_error "git clone of oh-my-zsh repo failed"
|
||||
exit 1
|
||||
}
|
||||
# Exit installation directory
|
||||
cd -
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
setup_zshrc() {
|
||||
# Keep most recent old .zshrc at .zshrc.pre-oh-my-zsh, and older ones
|
||||
# with datestamp of installation that moved them aside, so we never actually
|
||||
# destroy a user's original zshrc
|
||||
echo "${FMT_BLUE}Looking for an existing zsh config...${FMT_RESET}"
|
||||
|
||||
# Must use this exact name so uninstall.sh can find it
|
||||
OLD_ZSHRC="$zdot/.zshrc.pre-oh-my-zsh"
|
||||
if [ -f "$zdot/.zshrc" ] || [ -h "$zdot/.zshrc" ]; then
|
||||
# Skip this if the user doesn't want to replace an existing .zshrc
|
||||
if [ "$KEEP_ZSHRC" = yes ]; then
|
||||
echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Keeping...${FMT_RESET}"
|
||||
return
|
||||
fi
|
||||
if [ -e "$OLD_ZSHRC" ]; then
|
||||
OLD_OLD_ZSHRC="${OLD_ZSHRC}-$(date +%Y-%m-%d_%H-%M-%S)"
|
||||
if [ -e "$OLD_OLD_ZSHRC" ]; then
|
||||
fmt_error "$OLD_OLD_ZSHRC exists. Can't back up ${OLD_ZSHRC}"
|
||||
fmt_error "re-run the installer again in a couple of seconds"
|
||||
exit 1
|
||||
fi
|
||||
mv "$OLD_ZSHRC" "${OLD_OLD_ZSHRC}"
|
||||
|
||||
echo "${FMT_YELLOW}Found old .zshrc.pre-oh-my-zsh." \
|
||||
"${FMT_GREEN}Backing up to ${OLD_OLD_ZSHRC}${FMT_RESET}"
|
||||
fi
|
||||
echo "${FMT_YELLOW}Found ${zdot}/.zshrc.${FMT_RESET} ${FMT_GREEN}Backing up to ${OLD_ZSHRC}${FMT_RESET}"
|
||||
mv "$zdot/.zshrc" "$OLD_ZSHRC"
|
||||
fi
|
||||
|
||||
echo "${FMT_GREEN}Using the Oh My Zsh template file and adding it to $zdot/.zshrc.${FMT_RESET}"
|
||||
|
||||
# Modify $ZSH variable in .zshrc directory to use the literal $ZDOTDIR or $HOME
|
||||
omz="$ZSH"
|
||||
if [ -n "$ZDOTDIR" ] && [ "$ZDOTDIR" != "$HOME" ]; then
|
||||
omz=$(echo "$omz" | sed "s|^$ZDOTDIR/|\$ZDOTDIR/|")
|
||||
fi
|
||||
omz=$(echo "$omz" | sed "s|^$HOME/|\$HOME/|")
|
||||
|
||||
sed "s|^export ZSH=.*$|export ZSH=\"${omz}\"|" "$ZSH/templates/zshrc.zsh-template" > "$zdot/.zshrc-omztemp"
|
||||
mv -f "$zdot/.zshrc-omztemp" "$zdot/.zshrc"
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
setup_shell() {
|
||||
# Skip setup if the user wants or stdin is closed (not running interactively).
|
||||
if [ "$CHSH" = no ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If this user's login shell is already "zsh", do not attempt to switch.
|
||||
if [ "$(basename -- "$SHELL")" = "zsh" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# If this platform doesn't provide a "chsh" command, bail out.
|
||||
if ! command_exists chsh; then
|
||||
cat <<EOF
|
||||
I can't change your shell automatically because this system does not have chsh.
|
||||
${FMT_BLUE}Please manually change your default shell to zsh${FMT_RESET}
|
||||
EOF
|
||||
return
|
||||
fi
|
||||
|
||||
echo "${FMT_BLUE}Time to change your default shell to zsh:${FMT_RESET}"
|
||||
|
||||
# Prompt for user choice on changing the default login shell
|
||||
printf '%sDo you want to change your default shell to zsh? [Y/n]%s ' \
|
||||
"$FMT_YELLOW" "$FMT_RESET"
|
||||
read -r opt
|
||||
case $opt in
|
||||
y*|Y*|"") ;;
|
||||
n*|N*) echo "Shell change skipped."; return ;;
|
||||
*) echo "Invalid choice. Shell change skipped."; return ;;
|
||||
esac
|
||||
|
||||
# Check if we're running on Termux
|
||||
case "$PREFIX" in
|
||||
*com.termux*) termux=true; zsh=zsh ;;
|
||||
*) termux=false ;;
|
||||
esac
|
||||
|
||||
if [ "$termux" != true ]; then
|
||||
# Test for the right location of the "shells" file
|
||||
if [ -f /etc/shells ]; then
|
||||
shells_file=/etc/shells
|
||||
elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
|
||||
shells_file=/usr/share/defaults/etc/shells
|
||||
else
|
||||
fmt_error "could not find /etc/shells file. Change your default shell manually."
|
||||
return
|
||||
fi
|
||||
|
||||
# Get the path to the right zsh binary
|
||||
# 1. Use the most preceding one based on $PATH, then check that it's in the shells file
|
||||
# 2. If that fails, get a zsh path from the shells file, then check it actually exists
|
||||
if ! zsh=$(command -v zsh) || ! grep -qx "$zsh" "$shells_file"; then
|
||||
if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -n 1) || [ ! -f "$zsh" ]; then
|
||||
fmt_error "no zsh binary found or not present in '$shells_file'"
|
||||
fmt_error "change your default shell manually."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# We're going to change the default shell, so back up the current one
|
||||
if [ -n "$SHELL" ]; then
|
||||
echo "$SHELL" > "$zdot/.shell.pre-oh-my-zsh"
|
||||
else
|
||||
grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > "$zdot/.shell.pre-oh-my-zsh"
|
||||
fi
|
||||
|
||||
echo "Changing your shell to $zsh..."
|
||||
|
||||
# Check if user has sudo privileges to run `chsh` with or without `sudo`
|
||||
#
|
||||
# This allows the call to succeed without password on systems where the
|
||||
# user does not have a password but does have sudo privileges, like in
|
||||
# Google Cloud Shell.
|
||||
#
|
||||
# On systems that don't have a user with passwordless sudo, the user will
|
||||
# be prompted for the password either way, so this shouldn't cause any issues.
|
||||
#
|
||||
if user_can_sudo; then
|
||||
sudo -k chsh -s "$zsh" "$USER" # -k forces the password prompt
|
||||
else
|
||||
chsh -s "$zsh" "$USER" # run chsh normally
|
||||
fi
|
||||
|
||||
# Check if the shell change was successful
|
||||
if [ $? -ne 0 ]; then
|
||||
fmt_error "chsh command unsuccessful. Change your default shell manually."
|
||||
else
|
||||
export SHELL="$zsh"
|
||||
echo "${FMT_GREEN}Shell successfully changed to '$zsh'.${FMT_RESET}"
|
||||
fi
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2183 # printf string has more %s than arguments ($FMT_RAINBOW expands to multiple arguments)
|
||||
print_success() {
|
||||
printf '%s %s__ %s %s %s %s %s__ %s\n' $FMT_RAINBOW $FMT_RESET
|
||||
printf '%s ____ %s/ /_ %s ____ ___ %s__ __ %s ____ %s_____%s/ /_ %s\n' $FMT_RAINBOW $FMT_RESET
|
||||
printf '%s / __ \\%s/ __ \\ %s / __ `__ \\%s/ / / / %s /_ / %s/ ___/%s __ \\ %s\n' $FMT_RAINBOW $FMT_RESET
|
||||
printf '%s/ /_/ /%s / / / %s / / / / / /%s /_/ / %s / /_%s(__ )%s / / / %s\n' $FMT_RAINBOW $FMT_RESET
|
||||
printf '%s\\____/%s_/ /_/ %s /_/ /_/ /_/%s\\__, / %s /___/%s____/%s_/ /_/ %s\n' $FMT_RAINBOW $FMT_RESET
|
||||
printf '%s %s %s %s /____/ %s %s %s %s....is now installed!%s\n' $FMT_RAINBOW $FMT_GREEN $FMT_RESET
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf "%s %s %s\n" "Before you scream ${FMT_BOLD}${FMT_YELLOW}Oh My Zsh!${FMT_RESET} look over the" \
|
||||
"$(fmt_code "$(fmt_link ".zshrc" "file://$zdot/.zshrc" --text)")" \
|
||||
"file to select plugins, themes, and options."
|
||||
printf '\n'
|
||||
printf '%s\n' "• Follow us on X: $(fmt_link @ohmyzsh https://x.com/ohmyzsh)"
|
||||
printf '%s\n' "• Join our Discord community: $(fmt_link "Discord server" https://discord.gg/ohmyzsh)"
|
||||
printf '%s\n' "• Get stickers, t-shirts, coffee mugs and more: $(fmt_link "Planet Argon Shop" https://shop.planetargon.com/collections/oh-my-zsh)"
|
||||
printf '%s\n' $FMT_RESET
|
||||
}
|
||||
|
||||
main() {
|
||||
# Run as unattended if stdin is not a tty
|
||||
if [ ! -t 0 ]; then
|
||||
RUNZSH=no
|
||||
CHSH=no
|
||||
fi
|
||||
|
||||
# Parse arguments
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--unattended) RUNZSH=no; CHSH=no ;;
|
||||
--skip-chsh) CHSH=no ;;
|
||||
--keep-zshrc) KEEP_ZSHRC=yes ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
setup_color
|
||||
|
||||
if ! command_exists zsh; then
|
||||
echo "${FMT_YELLOW}Zsh is not installed.${FMT_RESET} Please install zsh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$ZSH" ]; then
|
||||
echo "${FMT_YELLOW}The \$ZSH folder already exists ($ZSH).${FMT_RESET}"
|
||||
if [ "$custom_zsh" = yes ]; then
|
||||
cat <<EOF
|
||||
|
||||
You ran the installer with the \$ZSH setting or the \$ZSH variable is
|
||||
exported. You have 3 options:
|
||||
|
||||
1. Unset the ZSH variable when calling the installer:
|
||||
$(fmt_code "ZSH= sh install.sh")
|
||||
2. Install Oh My Zsh to a directory that doesn't exist yet:
|
||||
$(fmt_code "ZSH=path/to/new/ohmyzsh/folder sh install.sh")
|
||||
3. (Caution) If the folder doesn't contain important information,
|
||||
you can just remove it with $(fmt_code "rm -r $ZSH")
|
||||
|
||||
EOF
|
||||
else
|
||||
echo "You'll need to remove it if you want to reinstall."
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create ZDOTDIR folder structure if it doesn't exist
|
||||
if [ -n "$ZDOTDIR" ]; then
|
||||
mkdir -p "$ZDOTDIR"
|
||||
fi
|
||||
|
||||
setup_ohmyzsh
|
||||
setup_zshrc
|
||||
setup_shell
|
||||
|
||||
print_success
|
||||
|
||||
if [ $RUNZSH = no ]; then
|
||||
echo "${FMT_YELLOW}Run zsh to try it out.${FMT_RESET}"
|
||||
exit
|
||||
fi
|
||||
|
||||
exec zsh -l
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define and Add 1920x1080 screen Resolution
|
||||
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
|
||||
xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
|
||||
xrandr --addmode eDP-1 1920x1080_60.00
|
||||
xrandr --addmode eDP-1 1600x900_60.00
|
||||
xrandr --output eDP-1 --mode 1920x1080_60.00
|
||||
|
||||
bash ~/.config/polybar/launch.sh --forest
|
||||
@@ -0,0 +1 @@
|
||||
netbird down
|
||||
@@ -0,0 +1 @@
|
||||
netbird up
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# Define and Add 1920x1080 screen Resolution
|
||||
# cvt 1920 1080
|
||||
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
|
||||
xrandr --newmode "1600x900_60.00" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
|
||||
|
||||
xrandr --addmode eDP-1 1920x1080_60.00
|
||||
xrandr --addmode eDP-1 1600x900_60.00
|
||||
|
||||
xrandr --output eDP-1 --mode 1600x900_60.00
|
||||
#xrandr --output eDP-1 --mode 1920x1080_60.00
|
||||
|
||||
|
||||
# Disables Netbird connection
|
||||
netbird down
|
||||
|
||||
# Mount my One drive from Microsoft
|
||||
rclone --vfs-cache-mode writes mount OneDrive: /home/miker/Documents/OneDrive &
|
||||
@@ -0,0 +1,4 @@
|
||||
# Resetting Permissions on SSH directory
|
||||
chmod 700 /home/miker/.ssh
|
||||
chmod 644 /home/miker/.ssh/*.pub
|
||||
chmod 600 /home/miker/.ssh/id_rsa
|
||||
@@ -0,0 +1,4 @@
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo apt autoremove
|
||||
sudo apt autoclean
|
||||
@@ -0,0 +1,8 @@
|
||||
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg \
|
||||
| gpg --dearmor \
|
||||
| sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
|
||||
|
||||
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' \
|
||||
| sudo tee /etc/apt/sources.list.d/vscodium.list
|
||||
|
||||
sudo apt update && sudo apt install codium
|
||||
@@ -0,0 +1 @@
|
||||
sudo wg-quick down wg0
|
||||
@@ -0,0 +1 @@
|
||||
sudo wg-quick up wg0
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
[Interface]
|
||||
PrivateKey = UIR0efntuhrYlvgdEwlxKFSE+mlzOnMlHgYy0xVQf2A=
|
||||
Address = 10.8.0.3/24
|
||||
# DNS = 1.1.1.1
|
||||
MTU = 1420
|
||||
|
||||
[Peer]
|
||||
PublicKey = P6/zP/c4/79sz6lJKHvKW+9WBzsdi2gOcsotsCr38D0=
|
||||
PresharedKey = PPuhMfZINpZW2uK8gV2ZIdpJVvWrgsq/q1VzwxQaOJY=
|
||||
AllowedIPs = 0.0.0.0/0, ::/0
|
||||
PersistentKeepalive = 0
|
||||
Endpoint = wireguard.mikemcfetridge.com:51820
|
||||
Reference in New Issue
Block a user