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))
|
|
|
|
|
2023-12-01 09:50:45 -05:00
|
|
|
(def packages {
|
2023-12-01 15:24:33 -05:00
|
|
|
:base ["bluez" "chromium" "emacs-gtk3" "fish-shell" "firefox" "flameshot" "flatpak" "git" "htop" "pass" "ranger" "Signal-Desktop" "thunar-archive-plugin" "wget" "xarchiver" "xclip"]
|
2023-12-01 09:50:45 -05:00
|
|
|
:work ["kotlin-bin" "scrcpy"]
|
|
|
|
})
|
|
|
|
|
|
|
|
(def flatpak-packages {
|
|
|
|
: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
|
|
|
})
|
|
|
|
|
2023-12-01 10:28:38 -05:00
|
|
|
(def toolbox-link "https://download.jetbrains.com/toolbox/jetbrains-toolbox-2.1.1.18388.tar.gz")
|
|
|
|
|
2023-12-01 09:50:45 -05:00
|
|
|
;;todo: allow to pick specific package sets later
|
|
|
|
|
|
|
|
;;installing normal xbps packages
|
|
|
|
(println "installing packages...")
|
|
|
|
(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
|
|
|
|
|
|
|
;;installing jetbrains toolbox
|
|
|
|
(println "installing jetbrains toolbox..")
|
|
|
|
(let [download-file (str home "/Downloads/toolbox.tar.gz")
|
|
|
|
target-directory (str home "/Applications/JetbrainsToolbox")]
|
|
|
|
(safe-sh "wget" "-O" download-file toolbox-link)
|
|
|
|
(fs/delete-tree target-directory)
|
|
|
|
(fs/create-dirs target-directory)
|
|
|
|
(fs/gunzip download-file target-directory {:replace-existing true})
|
|
|
|
(fs/delete (fs/file download-file))
|
|
|
|
(safe-sh "chown" (str user ":" user) "-R" target-directory))
|
2023-12-01 15:24:33 -05:00
|
|
|
(println "jetbrains toolbox installed")
|