From 5b43e25369b1aaab396d8496b5365d8bc74cc47a Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Mon, 17 Jun 2024 09:22:52 +0200 Subject: [PATCH] rework scripts to install packages more declaratively --- .chezmoidata/packages.yaml | 18 +++++++++++ .chezmoidata/vscode.yaml | 30 +++++++++++++++++++ fedora_packages | 12 -------- flatpaks | 2 -- run_once_20_install_vscode_extensions.sh.tmpl | 2 -- run_once_50_install_flatpaks.sh.tmpl | 6 ---- ...> run_onchange_10_install_packages.sh.tmpl | 15 ++-------- run_onchange_20_install_flatpaks.sh.tmpl | 2 ++ ...hange_50_install_vscode_extensions.sh.tmpl | 6 ++++ 9 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 .chezmoidata/packages.yaml create mode 100644 .chezmoidata/vscode.yaml delete mode 100644 fedora_packages delete mode 100644 flatpaks delete mode 100644 run_once_20_install_vscode_extensions.sh.tmpl delete mode 100644 run_once_50_install_flatpaks.sh.tmpl rename run_once_10_install_programs.sh.tmpl => run_onchange_10_install_packages.sh.tmpl (58%) create mode 100644 run_onchange_20_install_flatpaks.sh.tmpl create mode 100644 run_onchange_50_install_vscode_extensions.sh.tmpl diff --git a/.chezmoidata/packages.yaml b/.chezmoidata/packages.yaml new file mode 100644 index 0000000..119d2dd --- /dev/null +++ b/.chezmoidata/packages.yaml @@ -0,0 +1,18 @@ +packages: + linux: + fedora: + - bat + - codium + - fish + - fzf + - keychain + - neovim + - starship + - https://proton.me/download/PassDesktop/linux/x64/ProtonPass.rpm + flatpaks: + - com.getpostman.Postman + - com.spotify.Client + - one.ablaze.floorp + copr: + - atim/starship + diff --git a/.chezmoidata/vscode.yaml b/.chezmoidata/vscode.yaml new file mode 100644 index 0000000..23b81a7 --- /dev/null +++ b/.chezmoidata/vscode.yaml @@ -0,0 +1,30 @@ +vscode: + extensions: + - 42crunch.vscode-openapi + - aaron-bond.better-comments + - alexisvt.flutter-snippets + - asvetliakov.vscode-neovim + - biomejs.biome + - catppuccin.catppuccin-vsc + - catppuccin.catppuccin-vsc-icons + - codeium.codeium + - darkriszty.markdown-table-prettify + - dart-code.dart-code + - dart-code.flutter + - eamodio.gitlens + - editorconfig.editorconfig + - icrawl.discord-vscode + - jebbs.plantuml + - jirkavrba.subway-surfers + - naumovs.color-highlight + - oven.bun-vscode + - pdconsec.vscode-print + - prisma.prisma + - redhat.vscode-yaml + - rust-lang.rust-analyzer + - shan.code-settings-sync + - tamasfe.even-better-toml + - wix.vscode-import-cost + - yzane.markdown-pdf + - yzhang.markdown-all-in-one + diff --git a/fedora_packages b/fedora_packages deleted file mode 100644 index 6484898..0000000 --- a/fedora_packages +++ /dev/null @@ -1,12 +0,0 @@ -bat -codium -codium -fd-find -fish -fzf -gtk-murrine-engine -https://proton.me/download/bridge/protonmail-bridge-3.8.2-1.x86_64.rpm -keychain -neovim -starship - diff --git a/flatpaks b/flatpaks deleted file mode 100644 index 71360ef..0000000 --- a/flatpaks +++ /dev/null @@ -1,2 +0,0 @@ -com.getpostman.Postman -com.spotify.Client diff --git a/run_once_20_install_vscode_extensions.sh.tmpl b/run_once_20_install_vscode_extensions.sh.tmpl deleted file mode 100644 index b543762..0000000 --- a/run_once_20_install_vscode_extensions.sh.tmpl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -xargs -n1 -P4 codium --install-extension < {{ .chezmoi.sourceDir }}/vscode-extensions.txt diff --git a/run_once_50_install_flatpaks.sh.tmpl b/run_once_50_install_flatpaks.sh.tmpl deleted file mode 100644 index 50b5be9..0000000 --- a/run_once_50_install_flatpaks.sh.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# allow gtk themes to work with flatpaks -sudo flatpak override --filesystem=$HOME/.themes -sudo flatpak override --filesystem=$HOME/.icons - -xargs -a {{ .chezmoi.sourceDir -}}/flatpaks flatpak install diff --git a/run_once_10_install_programs.sh.tmpl b/run_onchange_10_install_packages.sh.tmpl similarity index 58% rename from run_once_10_install_programs.sh.tmpl rename to run_onchange_10_install_packages.sh.tmpl index 426dd9c..49fd1d4 100644 --- a/run_once_10_install_programs.sh.tmpl +++ b/run_onchange_10_install_packages.sh.tmpl @@ -1,21 +1,10 @@ -#!/bin/sh +#!/bin/bash {{ if eq .flavor "desktop" }} {{ if eq .chezmoi.osRelease.id "fedora" }} - # add codium sudo rpmkeys --import https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg printf "[gitlab.com_paulcarroty_vscodium_repo]\nname=download.vscodium.com\nbaseurl=https://download.vscodium.com/rpms/\nenabled=1\ngpgcheck=1\nrepo_gpgcheck=1\ngpgkey=https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/-/raw/master/pub.gpg\nmetadata_expire=1h" | sudo tee -a /etc/yum.repos.d/vscodium.repo -# add starship copr -sudo dnf copr enable atim/starship -y - -# install packages -sudo dnf check-update -sudo dnf install $(cat {{ .chezmoi.sourceDir -}}/fedora_packages) -y +sudo dnf install -y {{ .packages.linux.fedora | join " " -}} {{ end }} {{ end }} - -{{ if (and (eq .flavor "wm") (eq .chezmoi.osRelease.id "arch")) }} -# TODO add arch packages (1password for GPG, vscode for chezmoi edit) -sudo pacman -Sy - < arch_packages -{{ end }} diff --git a/run_onchange_20_install_flatpaks.sh.tmpl b/run_onchange_20_install_flatpaks.sh.tmpl new file mode 100644 index 0000000..b938458 --- /dev/null +++ b/run_onchange_20_install_flatpaks.sh.tmpl @@ -0,0 +1,2 @@ +#!/bin/bash +flatpak install -y --user {{ .packages.linux.flatpaks | join " " -}} diff --git a/run_onchange_50_install_vscode_extensions.sh.tmpl b/run_onchange_50_install_vscode_extensions.sh.tmpl new file mode 100644 index 0000000..c7f8c05 --- /dev/null +++ b/run_onchange_50_install_vscode_extensions.sh.tmpl @@ -0,0 +1,6 @@ +#!/bin/sh +{{ range .vscode.extensions }} +codium --install-extension {{ . | quote }} & +{{ end }} + +wait