First setup Droidnix. Structure, basic README.org, minimal emancs
This commit is contained in:
Executable
+165
@@ -0,0 +1,165 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Droidnix: Complete Emacs setup for Nix/Org tangling, HTML export, and a great editing experience
|
||||
# Installs packages in batch mode and configures them for interactive use.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Install Emacs (if not already installed)
|
||||
if ! command -v emacs &> /dev/null; then
|
||||
echo "Emacs not found. Installing Emacs..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y emacs
|
||||
fi
|
||||
|
||||
# Create a minimal Emacs config for package installation
|
||||
TEMP_CONFIG=$(mktemp /tmp/droidnix-emacs-setup.XXXXXX.el)
|
||||
cat > "$TEMP_CONFIG" << 'EOF'
|
||||
;; Minimal config for installing packages
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||
(package-initialize)
|
||||
EOF
|
||||
|
||||
# Install packages in batch mode
|
||||
emacs --batch \
|
||||
--load "$TEMP_CONFIG" \
|
||||
--eval "(package-refresh-contents)" \
|
||||
--eval "(package-install 'use-package)" \
|
||||
--eval "(package-install 'org)" \
|
||||
--eval "(package-install 'nix-mode)" \
|
||||
--eval "(package-install 'htmlize)" \
|
||||
--eval "(package-install 'catppuccin-theme)" \
|
||||
--eval "(package-install 'org-bullets)" \
|
||||
--eval "(package-install 'magit)" \
|
||||
--eval "(package-install 'company)" \
|
||||
--eval "(package-install 'flycheck)" \
|
||||
--eval "(package-install 'doom-modeline)" \
|
||||
--eval "(package-install 'which-key)" \
|
||||
--eval "(package-install 'projectile)" \
|
||||
--eval "(package-install 'ivy)" \
|
||||
--eval "(package-install 'counsel)" \
|
||||
--eval "(package-install 'all-the-icons)" \
|
||||
--eval "(package-install 'doom-themes)" \
|
||||
--eval "(package-install 'treemacs)" \
|
||||
--eval "(package-install 'lsp-mode)" \
|
||||
--eval "(package-install 'nix-mode)" \
|
||||
--eval "(package-install 'emacs-dashboard)"
|
||||
|
||||
# Create a post-install config for interactive use
|
||||
USER_EMACSCONFIG="${HOME}/.emacs.d/init.el"
|
||||
if [ ! -f "$USER_EMACSCONFIG" ]; then
|
||||
mkdir -p "${HOME}/.emacs.d"
|
||||
cat > "$USER_EMACSCONFIG" << 'EOF'
|
||||
;; Droidnix Emacs Configuration
|
||||
(require 'package)
|
||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||
(package-initialize)
|
||||
|
||||
;; Enable Catppuccin Mocha theme
|
||||
(when (fboundp 'load-theme)
|
||||
(ignore-errors
|
||||
(load-theme 'catppuccin-mocha t)
|
||||
(setq catppuccin-disable-term-colors nil)
|
||||
(setq catppuccin-enable-bold t)
|
||||
(setq catppuccin-enable-italic t)))
|
||||
|
||||
;; Enable Doom Modeline
|
||||
(when (fboundp 'doom-modeline-mode)
|
||||
(doom-modeline-mode 1))
|
||||
|
||||
;; Enable All The Icons
|
||||
(when (fboundp 'all-the-icons-install-fonts)
|
||||
(all-the-icons-install-fonts)
|
||||
(global-all-the-icons-mode))
|
||||
|
||||
;; Enable Treemacs
|
||||
(when (fboundp 'treemacs)
|
||||
(treemacs-mode))
|
||||
|
||||
;; Enable Company for autocomplete
|
||||
(when (fboundp 'company-mode)
|
||||
(global-company-mode))
|
||||
|
||||
;; Enable Flycheck for syntax checking
|
||||
(when (fboundp 'flycheck-mode)
|
||||
(global-flycheck-mode))
|
||||
|
||||
;; Enable Ivy + Counsel for better completion
|
||||
(when (fboundp 'ivy-mode)
|
||||
(ivy-mode 1)
|
||||
(setq ivy-use-virtual-buffers t)
|
||||
(when (fboundp 'counsel-mode)
|
||||
(counsel-mode 1)))
|
||||
|
||||
;; Enable Projectile for project management
|
||||
(when (fboundp 'projectile-mode)
|
||||
(projectile-mode +1)
|
||||
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map))
|
||||
|
||||
;; Enable Which Key for keybindings help
|
||||
(when (fboundp 'which-key-mode)
|
||||
(which-key-mode 1))
|
||||
|
||||
;; Enable Org Babel for Nix
|
||||
(require 'org)
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(nix . t)
|
||||
(shell . t)))
|
||||
(setq org-babel-tangle-lang-exts '(("nix" . "nix")))
|
||||
|
||||
;; Enable Org Bullets for better lists
|
||||
(when (fboundp 'org-bullets-mode)
|
||||
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
|
||||
|
||||
;; Enable Magit for Git
|
||||
(when (fboundp 'magit-version)
|
||||
(setq magit-display-buffer-function 'magit-display-buffer-fullscreen))
|
||||
|
||||
;; Enable LSP Mode for language server support
|
||||
(when (fboundp 'lsp-mode)
|
||||
(lsp-mode 1)
|
||||
(setq lsp-keymap-prefix "C-c l"))
|
||||
|
||||
;; Enable Dashboard
|
||||
(when (fboundp 'dashboard-refresh-buffer)
|
||||
(dashboard-mode 1))
|
||||
|
||||
;; Enable Nix Mode
|
||||
(when (fboundp 'nix-mode)
|
||||
(setq auto-mode-alist (cons '("\\.nix\\'" . nix-mode) auto-mode-alist)))
|
||||
|
||||
;; Custom keybindings
|
||||
(global-set-key (kbd "C-c t") 'treemacs)
|
||||
(global-set-key (kbd "C-c p") 'projectile-command-map)
|
||||
(global-set-key (kbd "C-c g") 'magit-status)
|
||||
(global-set-key (kbd "C-c d") 'dashboard-refresh-buffer)
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Clean up
|
||||
rm "$TEMP_CONFIG"
|
||||
|
||||
echo "Emacs setup complete with Catppuccin Mocha and all plugins!"
|
||||
echo "Installed packages:"
|
||||
echo " - Catppuccin Mocha (theme)"
|
||||
echo " - Org mode + Org Bullets"
|
||||
echo " - Magit (Git interface)"
|
||||
echo " - Company (autocomplete)"
|
||||
echo " - Flycheck (syntax checking)"
|
||||
echo " - Doom Modeline (status bar)"
|
||||
echo " - Which Key (keybindings help)"
|
||||
echo " - Projectile (project management)"
|
||||
echo " - Ivy + Counsel (completion framework)"
|
||||
echo " - All The Icons (pretty icons)"
|
||||
echo " - Treemacs (file tree)"
|
||||
echo " - LSP Mode (language server)"
|
||||
echo " - Emacs Dashboard (start page)"
|
||||
echo ""
|
||||
echo "You can now:"
|
||||
echo "1. Tangle Org files: emacs README.org --batch -f org-babel-tangle"
|
||||
echo "2. Export to HTML: emacs -Q --batch --eval '(setq org-html-htmlize-output-type nil)' README.org -f org-html-export-to-html"
|
||||
echo "3. Open Emacs interactively for the full experience with all plugins"
|
||||
echo "After this, use the Emacs config in ./assets/common/emacs.nix for future setups."
|
||||
Reference in New Issue
Block a user