55 lines
2.0 KiB
Clojure
Executable File
55 lines
2.0 KiB
Clojure
Executable File
#!/usr/bin/env bb
|
|
|
|
(require
|
|
'[babashka.fs :as fs])
|
|
|
|
;;todo: import from base.clj
|
|
(defn- safe-sh [& commands]
|
|
(as-> (apply shell/sh commands) $
|
|
(if (= (:exit $) 0) $ (throw (Exception. (:err $))))))
|
|
|
|
(def user (System/getenv "SUDO_USER"))
|
|
(def home (str "/home/" user))
|
|
|
|
(def packages {
|
|
:base ["bluez" "chromium" "emacs-gtk3" "fish-shell" "firefox" "flameshot" "flatpak" "git" "htop" "i3" "pass" "ranger" "Signal-Desktop" "thunar-archive-plugin" "wget" "xarchiver" "xclip" "xfce4-i3-workspaces-plugin"]
|
|
:work ["kotlin-bin" "scrcpy"]
|
|
})
|
|
|
|
(def flatpak-packages {
|
|
:work ["com.getpostman.Postman" "com.slack.Slack"]
|
|
:game ["com.discordapp.Discord"]
|
|
})
|
|
|
|
(def toolbox-link "https://download.jetbrains.com/toolbox/jetbrains-toolbox-2.1.1.18388.tar.gz")
|
|
|
|
;;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")
|
|
|
|
;;installing jetbrains toolbox
|
|
(println "installing jetbrains toolbox..")
|
|
(let [download-file-path (str home "/Downloads/toolbox.tar.gz")
|
|
target-directory (str home "/Applications/JetbrainsToolbox")
|
|
download-file (fs/file download-file-path)]
|
|
(safe-sh "wget" "-O" download-file-path toolbox-link)
|
|
(fs/delete-tree target-directory)
|
|
(fs/create-dirs target-directory)
|
|
(safe-sh "tar" "-xzf" download-file-path "-C" target-directory)
|
|
(fs/delete download-file)
|
|
(safe-sh "chown" (str user ":" user) "-R" target-directory))
|
|
(println "jetbrains toolbox installed")
|
|
|
|
;;todo: installing http toolkit
|