1
0
This commit is contained in:
Timo Bingmann
2025-07-09 13:56:42 -07:00
parent c38493b68b
commit b32484695f
2 changed files with 102 additions and 90 deletions

77
CLAUDE.md Normal file
View File

@@ -0,0 +1,77 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Repository Purpose
This repository contains a Nix home-manager flake configuration for setting up a user environment on a Linux system. It's designed for user `tbingmann` and includes configurations for Nix itself, Bash, direnv, Git, and other utilities. The configuration ensures Nix is properly installed and configured with experimental features enabled.
## Code Architecture
- **flake.nix**: The main Nix flake configuration file that defines inputs (dependencies) and outputs. It sets up the home-manager configuration for user `tbingmann`.
- **home.nix**: Contains the actual home-manager configuration including:
- User information
- Nix installation and configuration with flakes support
- Package installations
- Bash configuration and customizations with Nix PATH setup
- Direnv setup
- Git configuration
## Common Commands
### Applying Configuration Changes
After making changes to the configuration:
```bash
# If home-manager is not installed
nix run github:nix-community/home-manager/release-25.05 -- switch --flake .#tbingmann
# If home-manager is installed
home-manager switch --flake .#tbingmann
```
### Direct Installation from Git Repository
```bash
# If home-manager is not installed
nix --no-write-lock-file run github:nix-community/home-manager/release-25.05 -- switch --flake 'git+https://g.t1.xyz/tb/nix-ebay-home.git#tbingmann'
# If home-manager is installed
home-manager --no-write-lock-file switch --flake 'git+https://g.t1.xyz/tb/nix-ebay-home.git#tbingmann'
```
### Checking Configuration Validity
To validate configuration changes without applying them:
```bash
home-manager build --flake .#tbingmann
```
### Debugging Issues
For more detailed information when troubleshooting:
```bash
home-manager switch --flake .#tbingmann --debug
```
## Configuration Guidelines
When modifying this repository:
1. Update packages in the `home.packages` section of `home.nix`
2. Customize Bash settings in the `programs.bash` section
3. Add or modify program configurations under the `programs` attribute
4. Adjust Nix configuration in the `nix` section if needed
5. Ensure the username (`tbingmann`) is consistent throughout the configuration
## Nix Configuration Details
The configuration includes:
1. **Installation of Nix packages**: The `nix` package itself, `nixpkgs-fmt`, and `nix-direnv`
2. **Nix experimental features**: Enables both `nix-command` and `flakes` by default
3. **PATH configuration**: Sets up proper Nix paths in the Bash environment
4. **direnv integration**: Configured to work with Nix for project-specific environments

105
home.nix
View File

@@ -11,17 +11,18 @@
# Let Home Manager install and manage itself
programs.home-manager.enable = true;
# Nix configuration
nix = {
enable = true;
package = pkgs.nix;
settings = {
experimental-features = ["nix-command" "flakes"];
warn-dirty = false;
};
};
# Packages to install
home.packages = with pkgs; [
# Basic utilities
coreutils
curl
wget
htop
ripgrep
fd
jq
tree
];
# Bash configuration
@@ -29,35 +30,17 @@
enable = true;
enableCompletion = true;
# Shell aliases
shellAliases = {
ll = "ls -la";
".." = "cd ..";
"..." = "cd ../..";
"grep" = "grep --color=auto";
"rm" = "rm -i";
"cp" = "cp -i";
"mv" = "mv -i";
};
# Bash initialization
initExtra = ''
# Custom prompt
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Ensure Nix paths are properly set up
export PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH"
export NIX_PATH="$HOME/.nix-defexpr/channels:nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs"
# Additional bash customizations
export EDITOR=vim
export PATH="$HOME/.local/bin:$PATH"
# History settings
export HISTSIZE=10000
export HISTFILESIZE=10000
export HISTCONTROL=ignoreboth:erasedups
# Custom functions
function mkcd() {
mkdir -p "$1" && cd "$1"
}
# Source nix environment if it exists and not already sourced
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ] && [ -z "$NIX_SOURCED" ]; then
export NIX_SOURCED=1
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi
'';
# History configuration
@@ -66,8 +49,8 @@
"ignoredups"
"ignorespace"
];
historyFileSize = 10000;
historySize = 10000;
historyFileSize = 1000000;
historySize = 1000000;
};
# Direnv configuration
@@ -77,53 +60,5 @@
# Add hook to .bashrc
enableBashIntegration = true;
# Configuration
config = {
whitelist = {
prefix = [
"$HOME/projects"
"$HOME/work"
];
};
};
};
# Git configuration (useful with direnv)
programs.git = {
enable = true;
userName = "tbingmann";
userEmail = "tbingmann@example.com"; # Replace with actual email
# Basic configuration
extraConfig = {
core.editor = "vim";
init.defaultBranch = "main";
pull.rebase = false;
};
};
# Create default .envrc template in home directory
home.file.".envrc-template" = {
text = ''
# This is a template .envrc file for use with direnv
# Copy this to your project directory and customize as needed
# Load environment variables from .env file if it exists
if [ -f .env ]; then
dotenv
fi
# Example: Set project-specific environment variables
# export PROJECT_ROOT=$(pwd)
# export PATH=$PROJECT_ROOT/bin:$PATH
# Example: Use Nix shell
# use nix
# Example: Use flake
# use flake
'';
executable = false;
};
}