diff --git a/README.md b/README.md index 9d2e35f..d16a272 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Personal Linux Setup -My current setup is [Regolith OS](https://regolith-desktop.com/) which is basically Ubuntu + i3. +My current setup is [Linux Mint Vera](https://linuxmint.com/edition.php?id=302) with the [i3 window manager](https://i3wm.org/). ## Before installing -- Put asymmetric key pair in ~/.ssh -- Install git +- Put Ansible Vault password in .vault_password +- Install git and curl - Install Ansible: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html ## TODO @@ -29,8 +29,3 @@ As an intermediate solution, I can just put the password in keepass... - More cool plugins :) - dropdown autocomplete - https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#yamlls - -## Long-term TODO - -- Move away from GNOME because it is quite slow and configuration is pretty bad. This would also mean moving away from Regolith unfortunately. I would probably move to KDE with i3. Maybe there is some distro that does this OOTB? -- Move away from systemd. Not sure how feasibly that is nowadays, but I just get annoyed by some systemd "features" such as resolved. diff --git a/inventory/host_vars/self.yml b/inventory/host_vars/self.yml index f11b2ac..827f31f 100644 --- a/inventory/host_vars/self.yml +++ b/inventory/host_vars/self.yml @@ -1,6 +1,8 @@ +distribution_release: jammy first_name: Pim last_name: Kunis full_name: "{{ first_name }} {{ last_name }}" email: pim@kunis.nl vscodium_extensions: - shd101wyy.markdown-preview-enhanced +ssh_agent_socket: /tmp/ssh-agent.socket diff --git a/playbooks/laptop.yml b/playbooks/laptop.yml index f0a0d0f..df8979c 100644 --- a/playbooks/laptop.yml +++ b/playbooks/laptop.yml @@ -3,10 +3,18 @@ roles: - role: system tags: [system] + - role: i3 + tags: [i3] - role: bash tags: [bash] - role: alacritty tags: [alacritty] + - role: syncthing + tags: [syncthing] + vars: + syncthing_profile: "laptop" + - role: keepassxc + tags: [keepassxc] - role: wireguard tags: [wireguard] - role: asdf @@ -19,10 +27,6 @@ tags: [virtualbox] - role: vscodium tags: [vscodium] - - role: syncthing - tags: [syncthing] - vars: - syncthing_profile: "laptop" - role: strawberry tags: [strawberry] - role: nicotine diff --git a/playbooks/os3.yml b/playbooks/os3.yml index 69068c9..7548860 100644 --- a/playbooks/os3.yml +++ b/playbooks/os3.yml @@ -3,17 +3,21 @@ roles: - role: system tags: [system] + - role: i3 + tags: [i3] - role: bash tags: [bash] - role: alacritty tags: [alacritty] + - role: syncthing + tags: [syncthing] + vars: + syncthing_profile: "os3" + - role: keepassxc + tags: [keepassxc] - role: neovim tags: [neovim] - role: signal tags: [signal] - role: vscodium tags: [vscodium] - - role: syncthing - tags: [syncthing] - vars: - syncthing_profile: "os3" diff --git a/roles/alacritty/tasks/main.yml b/roles/alacritty/tasks/main.yml index 7d4d75f..3485b4f 100644 --- a/roles/alacritty/tasks/main.yml +++ b/roles/alacritty/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install PPA repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/alacritty.gpg] https://ppa.launchpadcontent.net/aslatter/ppa/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/alacritty.gpg] https://ppa.launchpadcontent.net/aslatter/ppa/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/bash/tasks/main.yml b/roles/bash/tasks/main.yml index 10cc1fe..5cad899 100644 --- a/roles/bash/tasks/main.yml +++ b/roles/bash/tasks/main.yml @@ -6,8 +6,8 @@ - bat - fzf - name: Install .bashrc - copy: - src: "{{ role_path }}/files/bashrc" + template: + src: "{{ role_path }}/templates/bashrc.j2" dest: ~/.bashrc - name: Install .fzf.bash copy: diff --git a/roles/bash/files/bashrc b/roles/bash/templates/bashrc.j2 similarity index 97% rename from roles/bash/files/bashrc rename to roles/bash/templates/bashrc.j2 index 04dcfbd..91d73a2 100644 --- a/roles/bash/files/bashrc +++ b/roles/bash/templates/bashrc.j2 @@ -100,3 +100,8 @@ alias vim='nvim' # asdf [ -f ~/.asdf/asdf.sh ] && source ~/.asdf/asdf.sh [ -f ~/.asdf/completions/asdf.bash ] && source ~/.asdf/completions/asdf.bash + +# pip scripts +PATH=$PATH:~/.local/bin + +export SSH_AUTH_SOCK="{{ ssh_agent_socket }}" diff --git a/roles/i3/files/config b/roles/i3/files/config new file mode 100644 index 0000000..de983bf --- /dev/null +++ b/roles/i3/files/config @@ -0,0 +1,143 @@ +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec i3-sensible-terminal + +# kill focused window +bindsym $mod+Shift+q kill + +# program picker +bindsym $mod+d exec --no-startup-id "rofi -modi drun,run -show drun" + +# change focus +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right +bindsym $mod+h focus left + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# toggle split direction +bindsym $mod+t split toggle + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + bindsym l resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym j resize shrink height 10 px or 10 ppt + bindsym h resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3status +} + +focus_follows_mouse no + +bindsym $mod+Escape exec i3lock diff --git a/roles/i3/tasks/main.yml b/roles/i3/tasks/main.yml new file mode 100644 index 0000000..ca1c9a2 --- /dev/null +++ b/roles/i3/tasks/main.yml @@ -0,0 +1,15 @@ +- name: Install packages + become: true + apt: + pkg: + - i3-wm + - rofi + - i3lock +- name: Create i3 config directory + file: + path: ~/.config/i3 + state: directory +- name: Copy i3 config + copy: + src: "{{ role_path }}/files/config" + dest: ~/.config/i3/config diff --git a/roles/system/files/keepassxc.ini b/roles/keepassxc/files/keepassxc.ini similarity index 100% rename from roles/system/files/keepassxc.ini rename to roles/keepassxc/files/keepassxc.ini diff --git a/roles/keepassxc/tasks/main.yml b/roles/keepassxc/tasks/main.yml new file mode 100644 index 0000000..6ef3c40 --- /dev/null +++ b/roles/keepassxc/tasks/main.yml @@ -0,0 +1,23 @@ +- name: Install Keepassxc + become: true + apt: + name: keepassxc +- name: Create keepassxc config directory + file: + path: ~/.config/keepassxc + state: directory +- name: Copy keepassxc.ini + copy: + src: "{{ role_path }}/files/keepassxc.ini" + dest: ~/.config/keepassxc/keepassxc.ini +- name: Create cache directory + file: + path: ~/.cache/keepassxc + state: directory + recurse: true +- name: Set SSH_AUTH_SOCK override + ini_file: + path: ~/.cache/keepassxc/keepassxc.ini + section: SSHAgent + option: AuthSockOverride + value: "{{ ssh_agent_socket }}" diff --git a/roles/neovim/tasks/main.yml b/roles/neovim/tasks/main.yml index 9f4839f..1611660 100644 --- a/roles/neovim/tasks/main.yml +++ b/roles/neovim/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install Neovim PPA become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/neovim.gpg] https://ppa.launchpadcontent.net/neovim-ppa/unstable/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/nicotine/tasks/main.yml b/roles/nicotine/tasks/main.yml index 63ec49a..18063b8 100644 --- a/roles/nicotine/tasks/main.yml +++ b/roles/nicotine/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install PPA repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/nicotine.gpg] https://ppa.launchpadcontent.net/nicotine-team/stable/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/nicotine.gpg] https://ppa.launchpadcontent.net/nicotine-team/stable/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/strawberry/tasks/main.yml b/roles/strawberry/tasks/main.yml index 04c8956..857cc1b 100644 --- a/roles/strawberry/tasks/main.yml +++ b/roles/strawberry/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install PPA repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/strawberry.gpg] https://ppa.launchpadcontent.net/jonaski/strawberry/ubuntu {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/strawberry.gpg] https://ppa.launchpadcontent.net/jonaski/strawberry/ubuntu {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true diff --git a/roles/system/files/Xresources b/roles/system/files/Xresources deleted file mode 100644 index 7c3ddfb..0000000 --- a/roles/system/files/Xresources +++ /dev/null @@ -1,5 +0,0 @@ -i3-wm.binding.split_h: c -i3-wm.binding.launcher.app: d - -i3-wm.binding.display: F1 -i3-wm.binding.settings: F2 diff --git a/roles/system/files/ssh_config b/roles/system/files/ssh_config index 24ccf45..2e513ae 100644 --- a/roles/system/files/ssh_config +++ b/roles/system/files/ssh_config @@ -1,3 +1,5 @@ +AddKeysToAgent yes + Host brussels HostName brussels.studlab.os3.nl User pkunis diff --git a/roles/system/tasks/main.yml b/roles/system/tasks/main.yml index 76947bd..f400174 100644 --- a/roles/system/tasks/main.yml +++ b/roles/system/tasks/main.yml @@ -4,7 +4,6 @@ pkg: - git - make - - keepassxc - ripgrep - curl - unzip @@ -19,18 +18,6 @@ template: src: "{{ role_path }}/templates/.gitconfig.j2" dest: ~/.gitconfig -- name: Copy Xresources - copy: - src: "{{ role_path }}/files/Xresources" - dest: ~/.config/regolith2/Xresources -- name: Create keepassxc config directory - file: - path: ~/.config/keepassxc - state: directory -- name: Copy keepassxc.ini - copy: - src: "{{ role_path }}/files/keepassxc.ini" - dest: ~/.config/keepassxc/keepassxc.ini - name: Create repos directory file: path: ~/repos @@ -44,7 +31,7 @@ - name: Install Hashicorp repository become: true apt_repository: - repo: "deb [signed-by=/etc/apt/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main" + repo: "deb [signed-by=/etc/apt/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com {{ distribution_release }} main" register: apt_repository - name: Update APT cache become: true @@ -61,3 +48,14 @@ src: "{{ role_path }}/files/ssh_config" dest: ~/.ssh/config mode: 0600 +- name: Copy systemd ssh-agent service + become: true + template: + src: "{{ role_path }}/templates/ssh-agent.service.j2" + dest: /etc/systemd/user/ssh-agent.service +- name: Enable ssh-agent service + systemd: + name: ssh-agent + enabled: true + scope: user + state: started diff --git a/roles/system/templates/ssh-agent.service.j2 b/roles/system/templates/ssh-agent.service.j2 new file mode 100644 index 0000000..266e412 --- /dev/null +++ b/roles/system/templates/ssh-agent.service.j2 @@ -0,0 +1,10 @@ +[Unit] +Description=SSH key agent + +[Service] +Type=simple +Environment=SSH_AUTH_SOCK={{ ssh_agent_socket }} +ExecStart=/usr/bin/ssh-agent -D -a $SSH_AUTH_SOCK + +[Install] +WantedBy=default.target diff --git a/roles/virtualbox/tasks/main.yml b/roles/virtualbox/tasks/main.yml index b49c81b..a0ca488 100644 --- a/roles/virtualbox/tasks/main.yml +++ b/roles/virtualbox/tasks/main.yml @@ -7,7 +7,7 @@ - name: Install VirtualBox APT repository become: true apt_repository: - repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/oracle_vbox_2016.asc] https://download.virtualbox.org/virtualbox/debian {{ ansible_distribution_release }} contrib" + repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/oracle_vbox_2016.asc] https://download.virtualbox.org/virtualbox/debian {{ distribution_release }} contrib" register: apt_repository tags: update - name: Update APT cache