working on zsh

This commit is contained in:
2026-03-11 14:21:24 +01:00
parent cf816ede62
commit 9146ac0124
8812 changed files with 810 additions and 587 deletions
+301
View File
@@ -0,0 +1,301 @@
#!/usr/bin/env bash
# Droidnix: Complete Emacs setup for Nix/Org tangling, HTML export, and a great editing experience
# For NixOS systems
set -euo pipefail
# Install Emacs and git via nix-shell (no apt-get)
if ! command -v emacs &> /dev/null; then
echo "Emacs not found. Installing Emacs and git via nix-shell..."
nix-shell -p emacs git --run "$0" "$@"
exit 0
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)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
EOF
# Install packages in batch mode
echo "Installing Emacs packages..."
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 '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 for NixOS
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; Basic UI improvements
(tool-bar-mode -1) ; Disable toolbar
(menu-bar-mode -1) ; Disable menu bar
(scroll-bar-mode -1) ; Disable scroll bar
(setq inhibit-startup-message t) ; Disable startup message
(setq make-backup-files nil) ; Disable backup files
(setq auto-save-default nil) ; Disable auto-save files
;; 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)
(setq treemacs-width 30)
(setq treemacs-position 'left)
(setq treemacs-space-between-root-nodes nil)
(setq treemacs-indent-level 2)
(setq treemacs-file-follow-delay 0.1)
(setq treemacs-git-icon-enabled t)
(setq treemacs-project-follow t)
(setq treemacs-display-project-root t)
(setq treemacs-show-hidden-files t))
;; Enable Company for autocomplete
(when (fboundp 'company-mode)
(global-company-mode)
(setq company-idle-delay 0.1)
(setq company-minimum-prefix-length 1))
;; Enable Flycheck for syntax checking
(when (fboundp 'flycheck-mode)
(global-flycheck-mode)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(setq flycheck-display-errors-delay 0.5))
;; Enable Ivy + Counsel for better completion
(when (fboundp 'ivy-mode)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq ivy-count-format "(%d/%d) ")
(setq ivy-height 10)
(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)
(setq projectile-completion-system 'ivy)
(setq projectile-switch-project-action 'projectile-dired))
;; Enable Which Key for keybindings help
(when (fboundp 'which-key-mode)
(which-key-mode 1)
(setq which-key-idle-delay 0.5)
(setq which-key-show-major-modes nil))
;; Configure Org Mode with Babel support for Nix and Shell
(require 'org)
(require 'ob-shell) ; Required for shell code blocks
(require 'ob-nix) ; Required for nix code blocks
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(nix . t)
(shell . t)
(python . t)
(dockerfile . t)))
(setq org-babel-tangle-lang-exts '(("nix" . "nix")))
(setq org-src-fontify-natively t)
(setq org-src-tab-act-as-tab t)
(setq org-edit-src-content-indentation 0)
(setq org-startup-indented t)
(setq org-startup-folded nil)
(setq org-ellipsis "⤵")
(setq org-hide-emphasis-markers t)
(setq org-image-actual-width nil)
(setq org-html-htmlize-output-type 'css)
(setq org-export-with-toc nil)
(setq org-todo-keywords '("TODO" "DOING" "|" "DONE" "CANCELED"))
(setq org-log-done 'time)
(setq org-directory "~/org")
(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)
(setq magit-last-seen-setup-instruction "1.4.0"))
;; Enable LSP Mode for language server support
(when (fboundp 'lsp-mode)
(lsp-mode 1)
(setq lsp-keymap-prefix "C-c l")
(setq lsp-enable-snippets nil)
(setq lsp-enable-indentation nil)
(setq lsp-enable-on-type-formatting nil)
(setq lsp-lens-enable nil)
(setq lsp-signature-auto-activate nil))
;; Enable Dashboard
(when (fboundp 'dashboard-refresh-buffer)
(dashboard-mode 1)
(setq dashboard-items '((recents . 5)
(projects . 5)
(agenda . 5)
(bookmarks . 5)))
(setq dashboard-center-content t)
(setq dashboard-banner-logo-title "Droidnix Configuration"))
;; Enable Nix Mode
(when (fboundp 'nix-mode)
(setq auto-mode-alist (cons '("\\.nix\\'" . nix-mode) auto-mode-alist))
(add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-mode)))
;; 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)
(global-set-key (kbd "C-c b") 'ivy-switch-buffer)
(global-set-key (kbd "C-c f") 'find-file)
(global-set-key (kbd "C-c s") 'save-buffer)
(global-set-key (kbd "C-c q") 'kill-buffer)
(global-set-key (kbd "C-c w") 'widen)
(global-set-key (kbd "C-c n") 'narrow-to-region)
;; Nix-specific configurations
(setq nix-indent-width 2)
(setq nix-continuation-indent-width 4)
;; HTML export settings for Org
(setq org-html-head-include-default-style nil)
(setq org-html-head-extra "
<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/tree.js@1.0.0/dist/tree.min.css\">
<script src=\"https://cdn.jsdelivr.net/npm/tree.js@1.0.0/dist/tree.min.js\"></script>
<style>
.tree { font-family: monospace; white-space: pre; }
#table-of-contents { display: none; }
.org-src-container { background-color: #313244; color: #cdd6f4; padding: 1em; border-radius: 5px; }
pre.src { background-color: #313244; padding: 1em; border-radius: 5px; }
</style>")
;; Function to wrap tree output in div for HTML export
(defun my/org-wrap-tree-in-div ()
"Wrap the Nix tree output in a div with class 'tree' for HTML export."
(interactive)
(save-excursion
(goto-char (point-min))
(when (re-search-forward "#+RESULTS:\n#+BEGIN_EXAMPLE\n\\(.*?\n\\)#+END_EXAMPLE" nil t)
(goto-char (match-beginning 1))
(insert "#+HTML: <div class=\"tree\">\n")
(goto-char (match-end 1))
(insert "#+HTML: </div>\n"))))
;; Add hook to automatically wrap tree output on export
(add-hook 'org-export-before-processing-hook 'my/org-wrap-tree-in-div)
;; Set default mode for new buffers
(setq-default major-mode 'text-mode)
(setq-default indent-tabs-mode nil)
(setq default-tab-width 2)
(setq tab-width 2)
;; Enable line numbers globally
(global-display-line-numbers-mode 1)
(setq display-line-numbers-type 'relative)
;; Configure fill column indicator
(setq display-fill-column-indicator t)
(setq display-fill-column-indicator-character ?│)
(setq fill-column 80)
;; Enable delete-selection-mode for more intuitive editing
(delete-selection-mode 1)
;; Configure modeline
(setq display-time-day-and-date t)
(setq display-time-24hr-format t)
;; Configure frame appearance
(setq default-frame-alist '((fullscreen . maximized)
(alpha . (95 95))
(vertical-scroll-bars . nil)
(tool-bar-lines . 0)
(menu-bar-lines . 0)
(line-spacing . 3)
(font . "Fira Code-12")))
EOF
fi
# Clean up
rm "$TEMP_CONFIG"
echo ""
echo "Emacs setup complete with Catppuccin Mocha and all plugins!"
echo ""
echo "Installed packages:"
echo " ✅ Catppuccin Mocha (theme)"
echo " ✅ Org mode + Org Bullets + Org Babel (Nix/Shell support)"
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 " ✅ ob-shell + ob-nix (Org Babel support)"
echo " ✅ Dashboard (start page)"
echo " ✅ tree.js (for collapsible directory trees in HTML export)"
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 README.org -f org-html-export-to-html"
echo "3. Open Emacs: emacs"
echo ""
echo "The configuration includes:"
echo "- Proper Org Babel support for shell and Nix"
echo "- Tree.js integration for collapsible directory trees in HTML export"
echo "- Custom keybindings for common operations"
echo "- Enhanced UI with Treemacs, Doom Modeline, and Catppuccin theme"
echo "- Optimized settings for Nix development"
echo "- HTML export with embedded CSS for better styling"
+22
View File
@@ -0,0 +1,22 @@
##############################################
# These files are just for reference.
# If you want to change anything, edit the source files in:
# ~/henrovnix/assets/conf
#
# After that, run:
# cd ~/henrovnix && emacs README.org --batch -f org-babel-tangle && git add . && git commit -m "Adjusted conf files" && sudo nixos-rebuild switch --flake .#<yourhost>
#
# If everything still works, you can use the same command but:
# - keep "switch"
# - and add a reboot:
#
# cd ~/henrovnix && sudo nixos-rebuild switch --flake .#<yourhost> && systemctl reboot
#
# NOTE:
# Make sure the lines starting with: cd ~/henrovnix
# are written as ONE single line.
##############################################
#app.zen_browser.zen
com.github.tchx84.Flatseal
eu.betterbird.Betterbird
com.todoist.Todoist
@@ -0,0 +1,123 @@
#!/usr/bin/env bash
set -euo pipefail
# Install Neovim and Neovide using nix-env with the correct attribute path for NixOS
echo "Installing Neovim and Neovide..."
nix-env -iA nixos.neovim nixos.neovide
# Create Neovim config directory
NVIM_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvim"
mkdir -p "$NVIM_CONFIG_DIR"
# Install packer.nvim (plugin manager)
PACKER_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/pack/packer/start/packer.nvim"
if [ ! -d "$PACKER_DIR" ]; then
echo "Installing packer.nvim..."
git clone --depth 1 https://github.com/wbthomason/packer.nvim "$PACKER_DIR"
fi
# Write minimal init.lua for literate NixOS
cat > "$NVIM_CONFIG_DIR/init.lua" << 'EOF'
-- Enable filetype detection, syntax highlighting, and indenting
vim.cmd([[
filetype plugin indent on
syntax on
]])
-- Leader key
vim.g.mapleader = " "
-- Install plugins with Packer
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
local packer_bootstrap = false
if fn.empty(fn.glob(install_path)) > 0 then
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
end
require('packer').startup(function(use)
-- Plugin manager
use 'wbthomason/packer.nvim'
-- Catppuccin theme
use { 'catppuccin/nvim', as = 'catppuccin' }
-- Orgmode for literate NixOS
use {
'nvim-orgmode/orgmode',
config = function()
require('orgmode').setup({
org_agenda_files = {'~/Documents/org/*'},
org_default_notes_file = '~/Documents/org/notes.org',
})
end
}
-- Treesitter (better syntax highlighting)
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = {'nix', 'org'},
highlight = { enable = true },
})
end
}
-- LSP (for Nix language server)
use {
'neovim/nvim-lspconfig',
config = function()
require('lspconfig').nil_ls.setup({})
end
}
-- Telescope (fuzzy finder)
use {
'nvim-telescope/telescope.nvim',
requires = {{'nvim-lua/plenary.nvim'}}
}
-- Automatically set up after cloning packer.nvim
if packer_bootstrap then
require('packer').sync()
end
end)
-- Set Catppuccin theme
vim.cmd.colorscheme('catppuccin-mocha')
-- Keybindings for orgmode
vim.api.nvim_set_keymap('n', '<leader>oo', '<cmd>lua require("orgmode").action("agenda.prompt")<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>oc', '<cmd>lua require("orgmode").action("capture.prompt")<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>ot', '<cmd>lua require("orgmode").action("tangle.current_file")<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>oe', '<cmd>lua require("orgmode").action("export.current_file")<cr>', { noremap = true, silent = true })
-- Auto-install LSP and Treesitter parsers on first run
vim.api.nvim_create_autocmd('BufEnter', {
pattern = {'*.nix', '*.org'},
callback = function()
vim.cmd('TSInstall! nix')
vim.cmd('TSInstall! org')
end,
})
EOF
# Install nil (Nix language server)
echo "Installing nil (Nix language server)..."
nix-env -iA nixos.nil
# Install Neovide config (optional)
NEOVIDE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/neovide"
mkdir -p "$NEOVIDE_CONFIG_DIR"
cat > "$NEOVIDE_CONFIG_DIR/config.toml" << 'EOF'
[editor]
theme = "catppuccin-mocha"
EOF
echo "Setup complete!"
echo "Run 'nvim' or 'neovide' to start."
echo "In Neovim, run ':PackerSync' to install plugins."
+44
View File
@@ -0,0 +1,44 @@
#productivity
todoist
# browsers
brave
chromium
# utils
wget
kdePackages.kdeconnect-kde
_1password-gui
tree
gparted
file
htop
wev
solaar
baobab
duf
zed-editor
eza
z-lua
# office
obsidian
onlyoffice-desktopeditors
# development
postman
tea
#jetbrains.pycharm
python3
# communication
nextcloud-talk-desktop
signal-desktop
openssl
# multimedia
audacity
handbrake
spotify
vlc
@@ -0,0 +1,84 @@
# vim:ft=kitty
## name: Catppuccin Kitty Mocha
## author: Catppuccin Org
## license: MIT
## upstream: https://github.com/catppuccin/kitty/blob/main/themes/mocha.conf
## blurb: Soothing pastel theme for the high-spirited!
# The basic colors
foreground #cdd6f4
background #1e1e2e
selection_foreground #1e1e2e
selection_background #f5e0dc
# Cursor colors
cursor #f5e0dc
cursor_text_color #1e1e2e
# Scrollbar colors
scrollbar_handle_color #9399b2
scrollbar_track_color #45475a
# URL color when hovering with mouse
url_color #f5e0dc
# Kitty window border colors
active_border_color #b4befe
inactive_border_color #6c7086
bell_border_color #f9e2af
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #11111b
active_tab_background #cba6f7
inactive_tab_foreground #cdd6f4
inactive_tab_background #181825
tab_bar_background #11111b
# Colors for marks (marked text in the terminal)
mark1_foreground #1e1e2e
mark1_background #b4befe
mark2_foreground #1e1e2e
mark2_background #cba6f7
mark3_foreground #1e1e2e
mark3_background #74c7ec
# The 16 terminal colors
# black
color0 #45475a
color8 #585b70
# red
color1 #f38ba8
color9 #f38ba8
# green
color2 #a6e3a1
color10 #a6e3a1
# yellow
color3 #f9e2af
color11 #f9e2af
# blue
color4 #89b4fa
color12 #89b4fa
# magenta
color5 #f5c2e7
color13 #f5c2e7
# cyan
color6 #94e2d5
color14 #94e2d5
# white
color7 #bac2de
color15 #a6adc8
@@ -0,0 +1,72 @@
##############################################
# Aliases (source-of-truth)
#
# This file is written in bash/zsh alias syntax in [bash_zsh], [bash_specific], [zsh_specific].
# Fish has different syntax; the Nix module translates [bash_zsh] into fish format and then
# appends [fish_specific] as-is.
##############################################
##############################################
# Generic aliases (bash/zsh)
# These are intended to be available in bash and zsh.
##############################################
[bash_zsh]
alias ll='ls -lah'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gcp='git add . && git commit && git push'
alias cd='z'
alias nps='xdg-open https://search.nixos.org'
alias hvnx='cd ~/Repos/nixos/henrovnix_ok'
alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html'
alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid'
alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid'
alias nxv='hvnx && sudo nixos-rebuild build-vm --flake .#traveldroid && "$(ls -1 ./result/bin/run-*-vm | head -n 1)"'
alias rb='systemctl reboot'
alias po='systemctl poweroff'
alias fpl='flatpak list'
alias fps='flatpak search'
alias fpi='flatpak install'
alias fpr='flatpak run'
alias nxc='ssh henrov@nextcloud.data-pro.nu'
alias vs='code'
alias blog='cd ~/Repos/blog && ll'
alias keys='hyprctl binds'
##############################################
# Shell-specific aliases / examples
#
# Everything below is COMMENTED OUT on purpose.
# These examples show syntax or commands that are shell-specific
# (or behave differently across shells).
##############################################
[bash_specific]
# Enable recursive globbing (**)
# alias sg='shopt -s globstar'
[zsh_specific]
# Recursive globbing works by default in zsh; this prints matches one-per-line
# alias recglob='print -l **/*.nix'
[fish_specific]
# Fish has its own language; this is fish-only syntax (not bash/zsh)
# alias setvar='set -gx EDITOR emacs'
[dash_specific]
# dash is a minimal POSIX shell; shown here only as an example
# alias com='command -v ls'
[nushell_specific]
# Nushell pipelines structured data; this is nu-only syntax
# alias fbf='ls | where size > 1mb | get name'
@@ -0,0 +1,15 @@
##############################################
# Enabled shells (source-of-truth)
#
# Edit this file in the repo:
# ./assets/conf/dev/terminal/enabled_shells.conf
#
# After changing, rebuild Home Manager / your system as you normally do.
##############################################
[enabled_shells]
bash = yes
zsh = yes
fish = no
dash = no
nushell = no