115 lines
3.1 KiB
Markdown
115 lines
3.1 KiB
Markdown
|
|
# 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
|
||
|
|
```
|