init by ai
This commit is contained in:
48
home/default.nix
Normal file
48
home/default.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{ config, lib, pkgs, pkgs-unstable, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./modules/shell.nix
|
||||
./modules/editor.nix
|
||||
./modules/git.nix
|
||||
./modules/dev-tools.nix
|
||||
];
|
||||
|
||||
# ============================================
|
||||
# Home Manager Shared Configuration
|
||||
# ============================================
|
||||
|
||||
home.username = "youruser";
|
||||
home.homeDirectory = "/home/youruser";
|
||||
home.stateVersion = "24.11";
|
||||
|
||||
# Home-level packages
|
||||
home.packages = with pkgs; [
|
||||
# Utilities
|
||||
tree
|
||||
unzip
|
||||
zip
|
||||
fzf
|
||||
bat
|
||||
exa
|
||||
tldr
|
||||
|
||||
# Unstable packages (if needed)
|
||||
# pkgs-unstable.some-package
|
||||
];
|
||||
|
||||
# Environment variables
|
||||
home.sessionVariables = {
|
||||
EDITOR = "vim";
|
||||
PAGER = "less";
|
||||
};
|
||||
|
||||
# Home Manager should manage itself
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Locale
|
||||
home.language = {
|
||||
base = "en_US.UTF-8";
|
||||
};
|
||||
|
||||
}
|
||||
54
home/modules/dev-tools.nix
Normal file
54
home/modules/dev-tools.nix
Normal file
@@ -0,0 +1,54 @@
|
||||
{ config, lib, pkgs, pkgs-unstable, ... }:
|
||||
|
||||
{
|
||||
# Development tools at user level
|
||||
home.packages = with pkgs; [
|
||||
# Debuggers
|
||||
lldb
|
||||
gdb
|
||||
|
||||
# Version managers
|
||||
fnm # Node version manager
|
||||
pyenv # Python version manager
|
||||
|
||||
# Build tools
|
||||
cmake
|
||||
ninja
|
||||
meson
|
||||
|
||||
# System tools
|
||||
tmux
|
||||
htop
|
||||
iotop
|
||||
|
||||
# Container tools
|
||||
podman
|
||||
podman-compose
|
||||
|
||||
# Cloud/Infrastructure
|
||||
# terraform
|
||||
# kubectl
|
||||
# helm
|
||||
|
||||
# Testing
|
||||
# pytest # Python
|
||||
# jest # JavaScript (via npm)
|
||||
];
|
||||
|
||||
# tmux configuration (optional)
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
baseIndex = 1;
|
||||
newSessionPath = "$HOME";
|
||||
shortcut = "a";
|
||||
|
||||
extraConfig = ''
|
||||
# Enable mouse
|
||||
set -g mouse on
|
||||
|
||||
# Vi-like navigation
|
||||
setw -g mode-keys vi
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
69
home/modules/editor.nix
Normal file
69
home/modules/editor.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{ config, lib, pkgs, pkgs-unstable, ... }:
|
||||
|
||||
{
|
||||
# Neovim as primary editor
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
ripgrep
|
||||
fd
|
||||
tree-sitter
|
||||
];
|
||||
|
||||
# Minimal LSP setup - expand as needed
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# essentials
|
||||
nvim-lspconfig
|
||||
nvim-cmp
|
||||
cmp-nvim-lsp
|
||||
luasnip
|
||||
friendly-snippets
|
||||
|
||||
# ui improvements
|
||||
telescope-nvim
|
||||
telescope-fzf-native-nvim
|
||||
lualine-nvim
|
||||
nvim-web-devicons
|
||||
nvim-tree-lua
|
||||
|
||||
# treesitter
|
||||
nvim-treesitter
|
||||
nvim-treesitter-context
|
||||
|
||||
# git integration
|
||||
gitsigns-nvim
|
||||
vim-fugitive
|
||||
];
|
||||
|
||||
# Basic init.lua configuration
|
||||
extraConfig = ''
|
||||
lua << EOF
|
||||
-- Basic settings
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- LSP
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
-- Python
|
||||
lspconfig.pyright.setup{}
|
||||
|
||||
-- Rust
|
||||
lspconfig.rust_analyzer.setup{}
|
||||
|
||||
-- Node/JavaScript
|
||||
lspconfig.ts_ls.setup{}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
|
||||
# Alternative: VS Code (uncomment if preferred)
|
||||
# programs.vscode.enable = true;
|
||||
|
||||
}
|
||||
56
home/modules/example-template.nix
Normal file
56
home/modules/example-template.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
# Template for creating new Home Manager modules
|
||||
# Copy this file and customize for your needs
|
||||
|
||||
{
|
||||
options.programs.myapp = {
|
||||
enable = lib.mkEnableOption "My application";
|
||||
|
||||
setting1 = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "default";
|
||||
description = "A configuration setting";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
cfg = config.programs.myapp;
|
||||
in lib.mkIf cfg.enable {
|
||||
|
||||
# Home packages needed for this app
|
||||
home.packages = with pkgs; [
|
||||
# myapp
|
||||
];
|
||||
|
||||
# Home Manager built-in programs and services
|
||||
# Example: configure a program via home-manager
|
||||
# programs.neovim.enable = true;
|
||||
|
||||
# Create custom files in home directory
|
||||
# home.file.".config/myapp/config.yaml".source = ./config.yaml;
|
||||
|
||||
# Set environment variables
|
||||
# home.sessionVariables = {
|
||||
# MY_VAR = "value";
|
||||
# };
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
# How to use this module:
|
||||
#
|
||||
# 1. Save this template as home/modules/myapp.nix
|
||||
#
|
||||
# 2. Import it in home/default.nix:
|
||||
# imports = [
|
||||
# ./modules/myapp.nix
|
||||
# ];
|
||||
#
|
||||
# 3. Enable in home/default.nix:
|
||||
# programs.myapp.enable = true;
|
||||
# programs.myapp.setting1 = "custom value";
|
||||
#
|
||||
# 4. Rebuild:
|
||||
# home-manager switch --flake .#myusername@linux
|
||||
30
home/modules/git.nix
Normal file
30
home/modules/git.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Your Name"; # TODO: Customize
|
||||
userEmail = "your.email@example.com"; # TODO: Customize
|
||||
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
pull.rebase = true;
|
||||
rebase.autoStash = true;
|
||||
};
|
||||
|
||||
aliases = {
|
||||
st = "status";
|
||||
co = "checkout";
|
||||
br = "branch";
|
||||
ci = "commit";
|
||||
unstage = "reset HEAD --";
|
||||
last = "log -1 HEAD";
|
||||
visual = "log --graph --oneline --all";
|
||||
};
|
||||
};
|
||||
|
||||
# GPG key signing (optional, uncomment if using)
|
||||
# programs.gpg.enable = true;
|
||||
# services.gpg-agent.enable = true;
|
||||
|
||||
}
|
||||
40
home/modules/shell.nix
Normal file
40
home/modules/shell.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
initExtra = ''
|
||||
# Custom shell initialization
|
||||
eval "$(direnv hook zsh)"
|
||||
eval "$(starship init zsh)"
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
ls = "exa -l";
|
||||
la = "exa -la";
|
||||
tree = "exa --tree";
|
||||
cat = "bat";
|
||||
cd = "z";
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "z";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "agkozak";
|
||||
repo = "zsh-z";
|
||||
rev = "v1.12.0";
|
||||
sha256 = "sha256-z7YhKUpn6uEEGT1iFSBpUG+w0D1M9YsvvZW8PwDh8T8=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
programs.starship.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user