1
0

first config

This commit is contained in:
Timo Bingmann
2025-07-09 13:39:51 -07:00
commit c38493b68b
5 changed files with 334 additions and 0 deletions

18
.gitignore vendored Normal file
View File

@@ -0,0 +1,18 @@
# Nix
result
result-*
# direnv
.direnv/
# Backup files
*~
*.bak
*.backup
# Logs
*.log
# Temporary files
*.swp
.DS_Store

114
README.md Normal file
View File

@@ -0,0 +1,114 @@
# Nix Home Manager Configuration
This repository contains a Nix home-manager flake for configuring a user environment on a remote Linux system with Nix installed. The configuration is designed for user `tbingmann` and includes custom Bash settings and direnv support.
## Features
- Custom Bash configuration with useful aliases and functions
- direnv integration for project-specific environment variables
- Git configuration
- Essential command-line utilities
## Prerequisites
- Nix package manager installed on the remote system
- Flakes enabled in Nix configuration
### Enabling Required Experimental Features
If you encounter errors about experimental features being disabled, you need to enable them. There are several ways to do this:
1. **Temporary solution** - Add flags to each command:
```bash
nix --extra-experimental-features "nix-command flakes" <command>
```
2. **Permanent solution** - Create or edit your `nix.conf` file:
For a single user:
```bash
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf
```
For system-wide configuration (requires sudo):
```bash
sudo mkdir -p /etc/nix
echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf
```
## Installation
### Local Installation
1. Clone this repository to your remote machine:
```bash
git clone https://g.t1.xyz/tb/nix-ebay-home.git ~/nix-home
cd ~/nix-home
```
2. Apply the configuration:
```bash
# If home-manager is not installeds
nix run github:nix-community/home-manager/release-25.05 -- switch --flake .#tbingmann
```
Alternatively, if you have home-manager installed:
```bash
home-manager switch --flake .#tbingmann
```
### Direct Installation from Git Repository
You can apply the configuration directly from a Git repository without cloning:
```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'
```
## Usage
### Updating
To update the configuration:
#### Local repository:
1. Modify the configuration files (`flake.nix`, `home.nix`)
2. Run `home-manager switch --flake .#tbingmann`
#### From remote Git repository:
```bash
# Pull latest changes from the repository
git -C ~/.config/home-manager pull
# Apply the updated configuration
home-manager switch --flake ~/.config/home-manager#tbingmann
# Or directly without pulling first
home-manager --no-write-lock-file switch --flake 'git+https://g.t1.xyz/tb/nix-ebay-home.git#tbingmann'
```
## Customization
- Edit `home.nix` to customize your home environment
- Modify Bash configuration in the `programs.bash` section
- Add or remove packages in the `home.packages` section
## Troubleshooting
If you encounter issues:
1. Check that Nix flakes are enabled
2. Ensure you're using the correct username in the configuration
3. Run with `--debug` flag for more information:
```bash
home-manager switch --flake .#tbingmann --debug
```

48
flake.lock generated Normal file
View File

@@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1752093218,
"narHash": "sha256-+3rXu8ewcNDi65/2mKkdSGrivQs5zEZVp5aYszXC0d0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "206ed3c71418b52e176f16f58805c96e84555320",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1751943650,
"narHash": "sha256-7orTnNqkGGru8Je6Un6mq1T8YVVU/O5kyW4+f9C1mZQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "88983d4b665fb491861005137ce2b11a9f89f203",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-25.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

25
flake.nix Normal file
View File

@@ -0,0 +1,25 @@
{
description = "Home Manager configuration for tbingmann";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations."tbingmann" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# Specify the path to your home configuration module
modules = [ ./home.nix ];
};
};
}

129
home.nix Normal file
View File

@@ -0,0 +1,129 @@
{ config, pkgs, ... }:
{
# Home Manager needs a bit of information about you and the paths it should manage
home.username = "tbingmann";
home.homeDirectory = "/home/tbingmann";
# Basic configuration
home.stateVersion = "25.05";
# Let Home Manager install and manage itself
programs.home-manager.enable = true;
# Packages to install
home.packages = with pkgs; [
# Basic utilities
coreutils
curl
wget
htop
ripgrep
fd
jq
tree
];
# Bash configuration
programs.bash = {
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\]\$ '
# 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"
}
'';
# History configuration
historyControl = [
"erasedups"
"ignoredups"
"ignorespace"
];
historyFileSize = 10000;
historySize = 10000;
};
# Direnv configuration
programs.direnv = {
enable = true;
nix-direnv.enable = true;
# 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;
};
}