2023-12-01 09:50:45 -05:00
|
|
|
#!/usr/bin/env bb
|
|
|
|
|
2023-12-01 10:28:38 -05:00
|
|
|
(require
|
2023-12-01 16:02:46 -05:00
|
|
|
'[babashka.fs :as fs])
|
2023-12-01 10:28:38 -05:00
|
|
|
|
2023-12-01 09:50:45 -05:00
|
|
|
;;todo: import from base.clj
|
|
|
|
(defn- safe-sh [& commands]
|
|
|
|
(as-> (apply shell/sh commands) $
|
|
|
|
(if (= (:exit $) 0) $ (throw (Exception. (:err $))))))
|
|
|
|
|
2023-12-01 16:02:46 -05:00
|
|
|
(def user (System/getenv "SUDO_USER"))
|
2023-12-01 10:28:38 -05:00
|
|
|
(def home (str "/home/" user))
|
|
|
|
|
2024-01-04 10:06:16 -05:00
|
|
|
(safe-sh "xbps-install" "-Sy" "void-repo-nonfree")
|
2024-01-05 07:54:42 -05:00
|
|
|
(safe-sh "xbps-install" "-Sy" "void-repo-multilib")
|
|
|
|
(safe-sh "xbps-install" "-Sy" "void-repo-multilib-nonfree")
|
|
|
|
(safe-sh "xbps-install" "-S")
|
2024-01-04 10:06:16 -05:00
|
|
|
|
2023-12-01 09:50:45 -05:00
|
|
|
(def packages {
|
2024-11-17 07:29:11 -05:00
|
|
|
:base ["atool" "alacritty" "alsa-firmware" "avahi" "bind-utils" "bluez" "bspwm" "chromium" "clojure" "curl" "cups" "cups-filters" "dragon" "emacs-gtk3" "fish-shell" "firefox" "flameshot" "flatpak" "font-firacode" "foomatic-db" "foomatic-db-nonfree" "fuse-exfat" "gimp" "git" "git-annex" "gparted" "guvcview" "htop" "intel-ucode" "inxi" "leiningen" "libgcc-32bit" "libstdc++-32bit" "libdrm-32bit" "libglvnd-32bit" "mtools" "nitrogen" "nss-mdns" "pamixer" "pass" "picom" "playerctl" "polybar" "ranger" "rofi" "Signal-Desktop" "sof-firmware" "sox" "ssr" "steam" "sysfsutils" "sxhkd" "the_silver_searcher" "udevil" "unzip" "wget" "xbindkeys" "xclip" "xz"]
|
2024-11-17 07:25:48 -05:00
|
|
|
:work ["android-udev-rules" "filezilla" "git-lfs" "kotlin-bin" "libcxx" "libbsd" "libcxxabi" "scrcpy"]
|
2024-03-15 07:51:44 -04:00
|
|
|
:intel ["mesa-intel-dri" "libva-intel-driver" "mesa-dri-32bit"]
|
2024-04-21 11:50:34 -04:00
|
|
|
:amd ["mesa-dri-32bit" "mesa-vulkan-radeon" "mesa-vaapi" "mesa-vdpau" "vulkan-loader"]
|
2023-12-01 09:50:45 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
(def flatpak-packages {
|
2024-12-08 06:24:30 -05:00
|
|
|
:base ["com.github.tchx84.Flatseal"]
|
2023-12-01 09:50:45 -05:00
|
|
|
:work ["com.getpostman.Postman" "com.slack.Slack"]
|
2023-12-01 15:24:33 -05:00
|
|
|
:game ["com.discordapp.Discord"]
|
2023-12-01 09:50:45 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
;;todo: allow to pick specific package sets later
|
|
|
|
|
|
|
|
;;installing normal xbps packages
|
2023-12-09 12:28:48 -05:00
|
|
|
(println "installing packages..")
|
2023-12-01 09:50:45 -05:00
|
|
|
(let [packages-to-install (flatten (vals packages))]
|
|
|
|
(apply safe-sh (concat ["xbps-install" "-y"] packages-to-install)))
|
|
|
|
(println "packages installed")
|
|
|
|
|
|
|
|
;;installing flatpak packages
|
|
|
|
(println "installing flatpak packages..")
|
|
|
|
(safe-sh "flatpak" "remote-add" "--if-not-exists" "flathub" "https://dl.flathub.org/repo/flathub.flatpakrepo")
|
|
|
|
(let [packages-to-install (flatten (vals flatpak-packages))]
|
|
|
|
(apply safe-sh (concat ["flatpak" "install" "flathub" "--noninteractive"] packages-to-install)))
|
|
|
|
(println "flatpak packages installed")
|
2023-12-01 10:28:38 -05:00
|
|
|
|
2023-12-09 14:19:02 -05:00
|
|
|
|
2024-04-04 04:59:54 -04:00
|
|
|
(def toolbox-link "https://download-cdn.jetbrains.com/toolbox/jetbrains-toolbox-2.2.3.20090.tar.gz")
|
2023-12-09 14:19:02 -05:00
|
|
|
|
2024-11-17 08:08:21 -05:00
|
|
|
(def http-toolkit-version "1.19.1")
|
2023-12-09 14:19:02 -05:00
|
|
|
(def http-toolkit-link (str "https://github.com/httptoolkit/httptoolkit-desktop/releases/download/v" http-toolkit-version "/HttpToolkit-linux-x64-" http-toolkit-version ".zip"))
|
|
|
|
|
|
|
|
(defn- install-application [link filename target-directory extract-command]
|
|
|
|
(let [download-file-path (str home "/Downloads/" filename)
|
|
|
|
download-file (fs/file download-file-path)]
|
|
|
|
(safe-sh "wget" "-O" download-file-path link)
|
|
|
|
(fs/delete-tree target-directory)
|
|
|
|
(fs/create-dirs target-directory)
|
|
|
|
(extract-command download-file-path target-directory)
|
|
|
|
(fs/delete download-file)
|
|
|
|
(safe-sh "chown" (str user ":" user) "-R" target-directory)))
|
|
|
|
|
2023-12-01 10:28:38 -05:00
|
|
|
;;installing jetbrains toolbox
|
2023-12-15 07:39:04 -05:00
|
|
|
(defn- install-jetbrains-toolbox []
|
|
|
|
(println "installing jetbrains toolbox..")
|
2023-12-09 14:19:02 -05:00
|
|
|
(let [target-directory (str home "/Applications/JetbrainsToolbox")]
|
|
|
|
(install-application
|
|
|
|
toolbox-link
|
|
|
|
"toolbox.tar.gz"
|
|
|
|
target-directory
|
|
|
|
#(safe-sh "tar" "-xzf" %1 "-C" %2)))
|
2023-12-15 07:39:04 -05:00
|
|
|
(println "jetbrains toolbox installed"))
|
2023-12-09 12:28:48 -05:00
|
|
|
|
2023-12-09 14:19:02 -05:00
|
|
|
;;installing http toolkit
|
2023-12-15 07:39:04 -05:00
|
|
|
(defn- install-http-toolkit []
|
|
|
|
(println "installing http toolkit..")
|
|
|
|
(let [target-directory (str home "/Applications/HttpToolkit")]
|
2023-12-09 14:19:02 -05:00
|
|
|
(install-application
|
|
|
|
http-toolkit-link
|
|
|
|
"httptoolkit.zip"
|
|
|
|
target-directory
|
|
|
|
#(safe-sh "unzip" %1 "-d" %2)))
|
2023-12-15 07:39:04 -05:00
|
|
|
(println "http toolkit installed"))
|
|
|
|
|
2024-01-04 10:06:16 -05:00
|
|
|
(let [applications-dir (str home "/Applications")]
|
|
|
|
(fs/create-dirs applications-dir)
|
|
|
|
(safe-sh "chown" (str user ":" user) "-R" applications-dir))
|
|
|
|
|
|
|
|
(install-jetbrains-toolbox)
|
|
|
|
(install-http-toolkit)
|