Initial commit: Ultimate Notetaking, Sync & Backup System
A NixOS-based system for managing personal data across three tiers: - Tier 1: Configuration (shareable via git) - Tier 2: Syncable data (nb + Syncthing) - Tier 3: Large data (self-hosted services + backup) Includes: - NixOS modules for nb, Syncthing, backup (restic) - Server modules for Forgejo, Immich, Jellyfin - Helper scripts (usync, ustatus) - Comprehensive documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
248
home/default.nix
Normal file
248
home/default.nix
Normal file
@@ -0,0 +1,248 @@
|
||||
# Home Manager Configuration
|
||||
#
|
||||
# User-level configuration for dotfiles and user services.
|
||||
# This is imported by home-manager in flake.nix.
|
||||
#
|
||||
# Customize for your user.
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# ============================================================================
|
||||
# USER INFO
|
||||
# ============================================================================
|
||||
|
||||
home.username = "youruser"; # Change this!
|
||||
home.homeDirectory = "/home/youruser"; # Change this!
|
||||
|
||||
# ============================================================================
|
||||
# PACKAGES
|
||||
# ============================================================================
|
||||
|
||||
home.packages = with pkgs; [
|
||||
# CLI tools
|
||||
ripgrep
|
||||
fd
|
||||
jq
|
||||
bat
|
||||
eza # ls replacement
|
||||
fzf
|
||||
htop
|
||||
|
||||
# Development
|
||||
git
|
||||
gh # GitHub CLI
|
||||
|
||||
# Notes & sync (also in system, but ensuring availability)
|
||||
nb
|
||||
];
|
||||
|
||||
# ============================================================================
|
||||
# GIT
|
||||
# ============================================================================
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Your Name"; # Change this!
|
||||
userEmail = "you@example.com"; # Change this!
|
||||
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
|
||||
# Sign commits (optional)
|
||||
# commit.gpgsign = true;
|
||||
# gpg.format = "ssh";
|
||||
# user.signingkey = "~/.ssh/id_ed25519.pub";
|
||||
};
|
||||
|
||||
# Useful aliases
|
||||
aliases = {
|
||||
st = "status";
|
||||
co = "checkout";
|
||||
br = "branch";
|
||||
ci = "commit";
|
||||
lg = "log --oneline --graph --decorate";
|
||||
};
|
||||
};
|
||||
|
||||
# ============================================================================
|
||||
# SHELL
|
||||
# ============================================================================
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
shellAliases = {
|
||||
# Nix
|
||||
rebuild = "sudo nixos-rebuild switch --flake ~/.config/nixos";
|
||||
update = "nix flake update ~/.config/nixos";
|
||||
|
||||
# Notes
|
||||
n = "nb";
|
||||
na = "nb add";
|
||||
ne = "nb edit";
|
||||
ns = "nb search";
|
||||
nsy = "nb sync";
|
||||
|
||||
# Files
|
||||
ls = "eza";
|
||||
ll = "eza -la";
|
||||
tree = "eza --tree";
|
||||
|
||||
# Sync
|
||||
sync = "nb sync && syncthing cli scan --all";
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
# nb completion
|
||||
eval "$(nb completions zsh)"
|
||||
|
||||
# FZF integration
|
||||
if command -v fzf &> /dev/null; then
|
||||
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
||||
source ${pkgs.fzf}/share/fzf/completion.zsh
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Alternative: Bash
|
||||
# programs.bash = {
|
||||
# enable = true;
|
||||
# shellAliases = { ... };
|
||||
# };
|
||||
|
||||
# ============================================================================
|
||||
# NEOVIM
|
||||
# ============================================================================
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# Essentials
|
||||
plenary-nvim
|
||||
telescope-nvim
|
||||
nvim-treesitter.withAllGrammars
|
||||
|
||||
# Git
|
||||
vim-fugitive
|
||||
gitsigns-nvim
|
||||
|
||||
# LSP (for Nix editing)
|
||||
nvim-lspconfig
|
||||
|
||||
# Quality of life
|
||||
comment-nvim
|
||||
which-key-nvim
|
||||
nvim-autopairs
|
||||
|
||||
# Theme
|
||||
catppuccin-nvim
|
||||
];
|
||||
|
||||
extraLuaConfig = ''
|
||||
-- Basic settings
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Theme
|
||||
vim.cmd.colorscheme "catppuccin"
|
||||
|
||||
-- Leader key
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Telescope
|
||||
local telescope = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', telescope.find_files, { desc = 'Find files' })
|
||||
vim.keymap.set('n', '<leader>fg', telescope.live_grep, { desc = 'Grep' })
|
||||
vim.keymap.set('n', '<leader>fb', telescope.buffers, { desc = 'Buffers' })
|
||||
|
||||
-- Git signs
|
||||
require('gitsigns').setup()
|
||||
|
||||
-- Comments
|
||||
require('Comment').setup()
|
||||
|
||||
-- Which-key
|
||||
require('which-key').setup()
|
||||
|
||||
-- Autopairs
|
||||
require('nvim-autopairs').setup()
|
||||
|
||||
-- LSP for Nix
|
||||
require('lspconfig').nil_ls.setup{}
|
||||
'';
|
||||
};
|
||||
|
||||
# ============================================================================
|
||||
# TMUX
|
||||
# ============================================================================
|
||||
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
terminal = "tmux-256color";
|
||||
prefix = "C-a";
|
||||
mouse = true;
|
||||
|
||||
extraConfig = ''
|
||||
# Split panes with | and -
|
||||
bind | split-window -h
|
||||
bind - split-window -v
|
||||
|
||||
# Vim-style pane navigation
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# Status bar
|
||||
set -g status-position top
|
||||
set -g status-style 'bg=default fg=white'
|
||||
'';
|
||||
};
|
||||
|
||||
# ============================================================================
|
||||
# DIRECTORIES
|
||||
# ============================================================================
|
||||
|
||||
# Create standard directories
|
||||
home.file = {
|
||||
".local/bin/.keep".text = ""; # Ensure bin directory exists
|
||||
};
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
documents = "$HOME/Documents";
|
||||
download = "$HOME/Downloads";
|
||||
music = "$HOME/Music";
|
||||
pictures = "$HOME/Pictures";
|
||||
videos = "$HOME/Videos";
|
||||
};
|
||||
};
|
||||
|
||||
# ============================================================================
|
||||
# STATE VERSION
|
||||
# ============================================================================
|
||||
|
||||
home.stateVersion = "24.05"; # Don't change after initial setup
|
||||
|
||||
# Let home-manager manage itself
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
Reference in New Issue
Block a user