Skip to content

Commit

Permalink
Merge branch 'sway'
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdp committed Mar 9, 2023
2 parents 9bc77d4 + 7b6118f commit 8e8803f
Show file tree
Hide file tree
Showing 96 changed files with 1,644 additions and 1,661 deletions.
7 changes: 4 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
## Install

1. Clone the repo into ~
2. `pip install --user -r requirements.txt`
3. `ansible-galaxy install -r requirements.yml`
4. `bin/dot-bootstrap`
1. `sudo apt install python3-pip`
1. `pip install --user -r requirements.txt`
1. `~/.local/bin/ansible-galaxy install -r requirements.yml`
1. `bin/dot-bootstrap`

## Update just one role

Expand Down
2 changes: 1 addition & 1 deletion bin/dot-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -e

echo "Setting up local environment..."
ansible-playbook -i ~/dotfiles/hosts -e host=$(hostname) ~/dotfiles/local.yml --ask-become-pass
~/.local/bin/ansible-playbook -i ~/dotfiles/hosts -e host=$(hostname) ~/dotfiles/local.yml --ask-become-pass
4 changes: 2 additions & 2 deletions bin/dot-update
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -e
if [[ $# -eq 0 ]]; then
# Run all roles except for the ones tagged with 'bootstrap'
echo "Updating up local environment..."
ansible-playbook -i ~/dotfiles/hosts -e host=$(hostname) ~/dotfiles/local.yml --skip-tags "bootstrap"
~/.local/bin/ansible-playbook -i ~/dotfiles/hosts -e host=$(hostname) ~/dotfiles/local.yml --skip-tags "bootstrap"
else
echo "Updating local environment... (--tags $@)"
ansible-playbook -i ~/dotfiles/hosts -e host=$(hostname) ~/dotfiles/local.yml --skip-tags "bootstrap" --tags $@
~/.local/bin/ansible-playbook -i ~/dotfiles/hosts -e host=$(hostname) ~/dotfiles/local.yml --skip-tags "bootstrap" --tags $@
fi
6 changes: 6 additions & 0 deletions bin/record
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/fish
set file ~/Videos/recording_$(date +%F_%H-%M-%S).mp4
# when user presses ctrl+c copy the file path to clipboard
trap 'echo -n $file | wl-copy' INT

wf-recorder -g "$(slurp)" -f $file $argv
12 changes: 12 additions & 0 deletions bin/screenshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/fish
set DIR ~/Pictures/Screenshots

if test ! -e "$DIR"
mkdir -p "$DIR"
end
set file $DIR/$(date +%F_%H-%M-%S).png

grim -g "$(slurp)" "$file"

# Copy file to clipboard
wl-copy < "$file"
Binary file added bin/waybar
Binary file not shown.
64 changes: 21 additions & 43 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dotfiles_user_home: "{{ '~' | expanduser }}"
dotfiles_home: "{{dotfiles_user_home}}/dotfiles"
dotfiles_home: "{{ dotfiles_user_home }}/dotfiles"

user: will
full_name: Will Pimblett
Expand All @@ -15,33 +15,24 @@ apt_repos:
key: https://pkgs.tailscale.com/stable/ubuntu/focal.gpg
- name: spotify
repo: deb http://repository.spotify.com stable non-free
key: https://download.spotify.com/debian/pubkey_5E3C45D7B312C643.gpg
key: https://download.spotify.com/debian/pubkey_7A3A762FAFD4A51F.gpg
- name: vscode
repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main
key: https://packages.microsoft.com/keys/microsoft.asc
- name: deadsnakes
repo: ppa:deadsnakes/ppa
- name: syncthing
repo: deb https://apt.syncthing.net/ syncthing stable
key: https://syncthing.net/release-key.gpg
- name: libreoffice
repo: ppa:libreoffice/ppa

apt_packages:
- arandr
- audacity
- baobab
- build-essential
- chromium-browser
- code
- curl
- dconf-editor
- default-jre
- feh
- flameshot
- fonts-noto
- gimp
- gnupg2
- gpick
- htop
- httpie
Expand All @@ -52,23 +43,20 @@ apt_packages:
- libpq-dev
- libreoffice
- libxslt1-dev
- lxappearance
- meld
- mpv
- ncdu
- nemo
- p7zip-full
- pass
- pass-extension-otp
- webext-browserpass
- pasystray
- pavucontrol
- playerctl
- powertop
- pwgen
- ruby
- ruby-dev
- screen
- screenruler
- software-properties-common
- spotify-client
- sshfs
Expand All @@ -83,32 +71,36 @@ apt_packages:
- wget
- whois
- wine
- xautomation
- xdotool
- zbar-tools
- speedcrunch
- libfuse2 # Needed for AppImages
- wdisplays # arandr but for wayland
- pandoc # Needed for Obsidian pandoc export
- qtwayland5 # Makes nomacs work in wayland

deb_packages:
- pkg: bat
url: https://github.com/sharkdp/bat/releases/download/v0.18.3/bat_0.18.3_amd64.deb
version: "0.18.3"
url: https://github.com/sharkdp/bat/releases/download/v0.22.1/bat_0.22.1_amd64.deb
version: "0.22.1"
- pkg: dive
url: https://github.com/wagoodman/dive/releases/download/v0.10.0/dive_0.10.0_linux_amd64.deb
version: "0.10.0"
- pkg: obsidian
url: https://github.com/obsidianmd/obsidian-releases/releases/download/v0.15.9/obsidian_0.15.9_amd64.deb
version: "0.15.9"
url: https://github.com/obsidianmd/obsidian-releases/releases/download/v1.1.15/obsidian_1.1.15_amd64.deb
version: "1.1.15"
- pkg: lsd
url: https://github.com/Peltoche/lsd/releases/download/0.20.1/lsd_0.20.1_amd64.deb
version: "0.20.1"
url: https://github.com/Peltoche/lsd/releases/download/0.23.1/lsd_0.23.1_amd64.deb
version: "0.23.1"
- pkg: steam-launcher
url: https://steamcdn-a.akamaihd.net/client/installer/steam.deb
- pkg: dug
url: https://github.com/unfrl/dug/releases/download/0.0.85/dug.0.0.85.linux-x64.deb
version: "0.0.85"

bins:
- name: aws-vault
url: https://github.com/99designs/aws-vault/releases/download/v6.3.1/aws-vault-linux-amd64
url: https://github.com/99designs/aws-vault/releases/download/v6.6.2/aws-vault-linux-amd64
archive: false
- name: difft
url: https://github.com/Wilfred/difftastic/releases/download/0.43.1/difft-x86_64-unknown-linux-gnu.tar.gz
archive: true

fish_paths:
- "~/bin"
Expand All @@ -117,22 +109,7 @@ fish_paths:
- "~/.poetry/bin"
- "/usr/local/go/bin"
- "~/go/bin"

fish_abbr:
- word: dc
expansion: docker compose
- word: g
expansion: git
- word: gc
expansion: git commit
- word: p
expansion: gopass
- word: tf
expansion: terraform
- word: avx
expansion: aws-vault exec
- word: avl
expansion: aws-vault login
- "~/.local/share/JetBrains/Toolbox/scripts"

fish_variables:
- name: fish_greeting
Expand Down Expand Up @@ -238,5 +215,6 @@ pip_user_packages:
- youtube-dl
- rofimoji
- awslogs
- virtualfish

docker_compose_version: "v2.2.3"
8 changes: 6 additions & 2 deletions host_vars/dux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ git_signing_key: 4DC1AA6287F8CC4A

wallpaper: ~/dotfiles/wallpapers/1440p/dennis-schweizer-18nR85wWyLY-unsplash.jpg

screen_left: DisplayPort-3
screen_right: DisplayPort-2
screen_left: DP-4
screen_right: DP-2
screen_left_w: 2560
screen_left_h: 1440
screen_right_w: 2560
screen_right_h: 1440
11 changes: 11 additions & 0 deletions host_vars/odyssey.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
git_email: [email protected]
git_signing_key: 1B48523D91781A7F5CEC929B7CA9BF9F444BF7C8

wallpaper: ~/dotfiles/wallpapers/1440p/dennis-schweizer-18nR85wWyLY-unsplash.jpg

screen_left: DP-2
screen_right: HDMI-A-1
screen_left_w: 2560
screen_left_h: 1440
screen_right_w: 2560
screen_right_h: 1440
4 changes: 4 additions & 0 deletions host_vars/victor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git_email: [email protected]
git_signing_key: 4DC1AA6287F8CC4A

wallpaper: ~/dotfiles/wallpapers/1440p/dennis-schweizer-18nR85wWyLY-unsplash.jpg
11 changes: 11 additions & 0 deletions host_vars/wgt152.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
git_email: [email protected]
git_signing_key: 1B48523D91781A7F5CEC929B7CA9BF9F444BF7C8

wallpaper: ~/dotfiles/wallpapers/1440p/dennis-schweizer-18nR85wWyLY-unsplash.jpg

screen_left: DP-2
screen_right: HDMI-A-1
screen_left_w: 2560
screen_left_h: 1440
screen_right_w: 2560
screen_right_h: 1440
3 changes: 3 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
dux
vulcan
vulcan-london
victor
wgt152
odyssey

[all:vars]
ansible_connection=local
Expand Down
10 changes: 8 additions & 2 deletions local.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
- name: Set up local machine
hosts: "{{ host }}"
roles:
- { role: grub, tags: ["grub"] }
- { role: snap, tags: ["snap"] }
- { role: apt, tags: ["apt"] }
- { role: bin, tags: ["bin"] }
- { role: linux, tags: ["linux"] }
- { role: python, tags: ["python"] }
- { role: dotfiles, tags: ["dotfiles"] }
- { role: autofs, tags: ["autofs"] }
- { role: fish, tags: ["fish"] }
- { role: fonts, tags: ["fonts"] }
- { role: gnome, tags: ["gnome"] }
- { role: regolith }
- { role: sway, tags: ["sway"] }
- { role: git, tags: ["git"] }
- { role: python, tags: ["python"] }
- { role: node, tags: ["node"] }
- { role: vim, tags: ["vim"] }
- { role: sublime, tags: ["sublime"] }
Expand All @@ -24,3 +26,7 @@
go_version: 1.17.8
GOPATH: /home/will/go
become: yes
- { role: blackd, tags: ["blackd"] }
- { role: syncthing, tags: ["syncthing"] }
- { role: wayland-tweaks, tags: ["wayland-tweaks"] }
- { role: plex-mpv, tags: ["plex-mpv"] }
17 changes: 10 additions & 7 deletions roles/apt/tasks/deb.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
- name: Check if {{ item.pkg }} is installed
- name: Run misc tasks
include_tasks: misc.yml

- name: "Check if {{ item.pkg }} {{ item.version }} is installed"
set_fact:
package_installed: "{{ item.pkg in ansible_facts.packages }}"

- name: Get installed {{ item.pkg }} version
- name: "Get installed {{ item.pkg }} version"
set_fact:
package_version: "{{ ansible_facts.packages[item.pkg][0].version }}"
when: package_installed and item.version is defined

- name: Decide if we should install {{ item.pkg }}
- name: "Decide if we should install {{ item.pkg }} {{ item.version }}"
set_fact:
should_install: >-
{{
Expand All @@ -21,13 +24,13 @@
)
}}
- name: "Download {{ item.pkg }} deb file"
- name: "Download {{ item.pkg }} {{ item.version }} deb file"
when: should_install
get_url:
url: "{{ item.url }}"
dest: "/tmp/{{ item.pkg }}.deb"
dest: "/tmp/{{ item.pkg }}-{{ item.version }}.deb"

- name: "Install {{ item.pkg }}"
- name: "Install {{ item.pkg }} {{ item.version }}"
when: should_install
become: yes
command: dpkg -i "/tmp/{{ item.pkg }}.deb"
command: dpkg -i "/tmp/{{ item.pkg }}-{{ item.version }}.deb"
15 changes: 15 additions & 0 deletions roles/apt/tasks/misc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: Prioritise fish PPA takes over Ubuntu's
become: yes
copy:
content: |
Package: fish
Pin: release o=LP-PPA-fish-shell
Pin-Priority: 990
Package: fish
Pin: release o=Ubuntu
Pin-Priority: -1
dest: /etc/apt/preferences.d/fish
owner: root
group: root
mode: 0644
2 changes: 1 addition & 1 deletion roles/autofs/templates/auto.sshfs.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% for mount in mounts %}
{{mount.name}} -fstype=fuse,rw,uid=1000,gid=1000,nodev,nonempty,noatime,allow_other,Ciphers=aes128-ctr,Compression=no,max_read=65536 :sshfs\#{{mount.host}}\:{{mount.path}}
{{mount.name}} -fstype=fuse,rw,uid=1000,gid=1000,nodev,noatime,allow_other,Ciphers=aes128-ctr,Compression=no,max_read=65536 :sshfs\#{{mount.host}}\:{{mount.path}}
{% endfor %}
8 changes: 8 additions & 0 deletions roles/bin/tasks/bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
dest: ~/bin/{{ item.name }}
mode: "0755"

- name: If {{ item.name }} is an archive, extract it
when: to_install and item.archive
unarchive:
src: ~/bin/{{ item.name }}
dest: ~/bin
remote_src: yes
mode: "0755"

- name: Write installed version (url) to file
when: to_install
copy:
Expand Down
5 changes: 5 additions & 0 deletions roles/bin/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
- name: Ensure bin directory exists
file:
path: "{{ dotfiles_user_home }}/bin"
state: directory

- name: Install bins
loop: "{{ bins }}"
include_tasks: bin.yml
10 changes: 10 additions & 0 deletions roles/blackd/files/blackd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Black Formatter

[Service]
ExecStart=/home/will/.local/bin/blackd --bind-host=127.0.0.1
Restart=on-failure
SyslogIdentifier=blackd

[Install]
WantedBy=default.target
22 changes: 22 additions & 0 deletions roles/blackd/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- name: Install blackd as user python package
pip:
name: black[d]
state: present

- name: Ensure ~/.config/systemd/user/ exists
file:
path: "{{ dotfiles_user_home }}/.config/systemd/user/"
state: directory

- name: Link blackd service file
file:
src: "{{ dotfiles_home }}/roles/blackd/files/blackd.service"
dest: "{{ dotfiles_user_home }}/.config/systemd/user/blackd.service"
state: link

- name: Enable blackd user service
systemd:
name: blackd
scope: user
enabled: true
state: started
Loading

0 comments on commit 8e8803f

Please sign in to comment.