Revert 'Add aports container image' (ed9fe0f432)

Also:
- Stop using the stupid patch for Vagrant (use the provided env instead)
- Fixes some templates
This commit is contained in:
Hoang Nguyen 2022-01-14 00:01:43 +07:00
parent 80358cd31b
commit 72a5517e13
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
16 changed files with 105 additions and 88 deletions

View File

@ -23,7 +23,4 @@ USER kawaii
WORKDIR /home/kawaii
COPY . .
# Slim down the image size
RUN doas rm -rf .git
CMD ["/bin/ash"]

View File

@ -8,20 +8,21 @@ This is the continuation of [my old dotfiles](https://git.disroot.org/FollieHiyu
# Install `community.general` for 'apk' and 'doas' module if you only installed ansible-core
$ ansible-galaxy collection install community.general
# Run the playbook
$ ansible-playbook dotfiles.yml
$ ansible-playbook -i hosts dotfiles.yml
```
`additional` directory contains other playbooks for installing packages.
## ✔️ Testing inside a container
## ✔️ Testing
```bash
# Build the image
# Build the container image
$ buildah build -t dotfiles -f Dockerfile .
# Run the playbook for all tasks
$ podman run --rm -i localhost/dotfiles ansible-playbook -v -i hosts dotfiles.yml --tags 'never,all'
# Exec into the container and look around
# Exec into the container
$ podman run --rm -it localhost/dotfiles /bin/ash
# Run the playbook for all tasks inside the containter
$ ansible-playbook -v -i hosts dotfiles.yml --tags 'never,all'
```
## 🖊️ TODO

34
additional/chroot.yml Normal file
View File

@ -0,0 +1,34 @@
---
- name: Build an Alpine chroot
hosts: all
gather_facts: yes
vars:
- chroot_dir: '{{ ansible_env.HOME }}/Alpine-chroot'
- repository: https://dl-cdn.alpinelinux.org/alpine
tasks:
- block:
- name: Ensure the chroot directory exists
file:
path: '{{ chroot_dir }}'
state: directory
mode: 0755
- name: Create the chroot
command:
cmd: 'apk -X {{ repository }}/edge/main -U --allow-untrusted -p {{ chroot_dir }} --initdb add alpine-base'
creates: '{{ chroot_dir }}/bin/busybox'
- name: Update the repository urls
template:
src: ./templates/repositories.j2
dest: '{{ chroot_dir }}/etc/apk/repositories'
owner: root
group: root
mode: 0644
become: yes
- name: Install a stupid script for chrooting
template:
src: ./templates/alpine-chroot.j2
dest: ~/.local/bin/alpine-chroot
mode: 0755

View File

@ -1,35 +0,0 @@
# https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package
# This image build an intermediated environment to build + test Alpine packages
#
# Usage:
# $ podman run --rm -it -v ~/packages:/home/kawaii/packages localhost/aports
# => doas chown kawaii:users ~/packages
FROM alpine:edge
# Change repositories
RUN printf 'https://download.nus.edu.sg/mirror/alpine/edge/main\n\
https://download.nus.edu.sg/mirror/alpine/edge/community\n\
https://download.nus.edu.sg/mirror/alpine/edge/testing\n' > /etc/apk/repositories
RUN apk add --no-cache alpine-sdk doas vim \
&& mkdir -p /var/cache/distfiles \
&& chgrp abuild /var/cache/distfiles \
&& chmod g+x /var/cache/distfiles
# Create a normal user
RUN echo 'permit nopass :wheel' > /etc/doas.d/doas.conf \
&& chmod 600 /etc/doas.d/doas.conf \
&& printf 'cuteuser\ncuteuser\n' | adduser -h /home/kawaii -s /bin/ash -G wheel kawaii \
&& adduser kawaii abuild
# abuild only works as normal user
USER kawaii
WORKDIR /home/kawaii
# Tell abuild-keygen to use doas
ENV SUDO=doas
RUN git clone --depth 1 https://gitlab.alpinelinux.org/alpine/aports.git \
&& printf "\n" | abuild-keygen -a -i
CMD ["/bin/ash"]

View File

@ -3,12 +3,6 @@
hosts: all
gather_facts: yes
tasks:
- name: aports | Build the container image
tags: aports
podman_image:
name: aports
path: container_images/aports
- name: ltex-ls | Build the container image
tags: ltex
podman_image:

View File

@ -1,16 +0,0 @@
diff --git a/bin/vagrant b/bin/vagrant
index b539d3479..571db1976 100755
--- a/bin/vagrant
+++ b/bin/vagrant
@@ -204,11 +204,6 @@ begin
end
end
- if !Vagrant.in_installer? && !Vagrant.very_quiet?
- # If we're not in the installer, warn.
- env.ui.warn(I18n.t("vagrant.general.not_in_installer") + "\n", prefix: false)
- end
-
# Acceptable experimental flag values include:
#
# Unset - Disables experimental features

View File

@ -12,18 +12,20 @@
upgrade: yes
update_cache: yes
# Install both mesa-dri-gallium and mesa-dri-classic here so that it
# works on all machines. Also add both vdpau and vaapi stuff
- name: Install system dependencies
apk:
name: >
build-base, rsync, cargo, py3-virtualenv, py3-setuptools, dunst,
alacritty, foot, fish, nushell, bash, amfora, bat, fd, ripgrep,
gpg, dbus, mpdris2, mpc, mpd, mpv, ncmpcpp, emacs-x11, neovim,
newsboat, pipewire, pipewire-pulse, wireplumber, polkit-elogind,
elogind, sway, river, swaylock, swayidle, waybar, wlr-randr, grim,
slurp, wl-clipboard, weechat, wofi, docs, xdg-desktop-portal-wlr,
alacritty, foot, nushell, bash, amfora, bat, fd, ripgrep,
gpg, mpdris2, mpc, mpd, mpv, ncmpcpp, emacs-x11, neovim,
newsboat, pipewire, pipewire-pulse, wireplumber,
sway, river, swaylock, swayidle, waybar, wlr-randr, grim,
slurp, wl-clipboard, wofi, docs, xdg-desktop-portal-wlr, go, curl,
xdg-desktop-portal-gtk, yt-dlp, vifm, zathura-pdf-mupdf, lang,
brillo, shadow-login, atool, hugo, curl, go, stylua, starship,
podman, buildah
brillo, atool, hugo, stylua, starship, podman, buildah, udisks2,
mesa-dri-classic, mesa-dri-gallium
state: present
tags: system
become: yes

View File

@ -12,8 +12,9 @@
chdir: '{{ tt_dir }}'
creates: '{{ tt_dir }}/tt'
- name: Install tt.fish
- name: Install custom launcher for tt
template:
src: ../templates/tt.j2
dest: ~/.config/fish/functions/tt.fish
dest: ~/.local/bin/tt
mode: 0755
force: yes

View File

@ -26,7 +26,7 @@
basedir: '{{ vagrant_dir }}'
strip: 1
- name: Build and install vagrant
- name: Build vagrant
command:
cmd: '{{ item }}'
chdir: '{{ vagrant_dir }}'
@ -35,7 +35,12 @@
- 'bundle config set --local path {{ vagrant_dir }}/vendor'
- bundle install
- bundle binstubs --all --path exec
- 'ln -sf {{ vagrant_dir }}/exec/vagrant ~/.local/bin/vagrant'
- name: Symlink vagrant executable
file:
src: '{{ vagrant_dir }}/exec/vagant'
dest: ~/.local/bin/vagrant
state: link
- block:
- name: Build vagrant-libvirt

View File

@ -0,0 +1,19 @@
#!/bin/sh
# Super stupid and lazy way to chroot
chroot_dir="{{ chroot_dir }}"
# Pre
doas mount -t proc none ${chroot_dir}/proc
doas mount -o bind,ro /dev ${chroot_dir}/dev
doas mount -o bind,ro /sys ${chroot_dir}/sys
doas cp -L /etc/resolv.conf ${chroot_dir}/etc/
# chroot
doas chroot ${chroot_dir} /bin/ash -l
# Post
doas umount -l ${chroot_dir}/dev
doas umount -l ${chroot_dir}/proc
doas umount -l ${chroot_dir}/sys

View File

@ -0,0 +1,3 @@
{{ repository }}/edge/main
{{ repository }}/edge/community
{{ repository }}/edge/testing

View File

@ -1,6 +1,10 @@
function tt -d "Typing speed testing"
iconv -f UTF-8 -t ASCII "$argv" | sed 's/--/-/g' \
| sed '/^$/d' | sed 's/^[ \t]*//' | sed 's/\(^.\{1,80\}\).*/\1/' \
> /tmp/tt.txt
{{ tt_dir }}/tt /tmp/tt.txt
end
#!/bin/sh
iconv -f UTF-8 -t ASCII "$@" | sed 's/--/-/g' \
| sed '/^$/d' | sed 's/^[ \t]*//' | sed 's/\(^.\{1,80\}\).*/\1/' \
> /tmp/tt.txt
{{ tt_dir }}/tt /tmp/tt.txt
# Clean up
rm -f /tmp/tt.txt

View File

@ -2,7 +2,7 @@
inventory = ./hosts
gathering = explicit
display_skipped_hosts = False
host_key_checking = True
host_key_checking = False
interpreter_python = auto_silent
[privilege_escalation]

View File

@ -23,6 +23,11 @@
msg: Variable 'notification' needs to be 'dunst' or 'mako'
when: notification != 'dunst' and notification != 'mako'
- name: Check current user
fail:
msg: This playbook should not be run as 'root'
when: ansible_real_user_id == 0
- name: Guarantee that ~/.config and ~/.local/share exist
file:
path: '{{ item }}'
@ -107,7 +112,7 @@
- role: waybar
tags: waybar
- role: weechat
tags: weechat
tags: [ never, weechat ]
- role: wofi
tags: wofi
- role: xdg-desktop-portal-wlr

View File

@ -9,7 +9,7 @@
src: fish/
dest: ~/.config/fish/
recursive: yes
delete: no
delete: yes
- name: Copy config templates
template:

View File

@ -53,15 +53,18 @@ set -gx MANPAGER "nvim +Man!"
# make man work for fish's built-in functions
set -gx MANPATH :$__fish_data_dir/man:$XDG_DATA_HOME/man
# Java GUI is meh
# Please don't use Java to write GUI apps
set -gx _JAVA_AWT_WM_NONREPARENTING 1
# don't ping proxy.golang.org all the time
set -gx GOPROXY direct
# Microsoft's cancer
# Microsoft is cancer
set -gx DOTNET_CLI_TELEMETRY_OPTOUT 1
# we build Vagrant ourselves
set -gx VAGRANT_I_KNOW_WHAT_IM_DOING_PLEASE_BE_QUIET true
# qt5ct
set -gx QT_QPA_PLATFORMTHEME qt5ct
set -gx QT_PLATFORM_PLUGIN qt5ct