1
0
Files
nix-ebay-home/home.nix
2025-07-18 17:38:30 -07:00

103 lines
2.8 KiB
Nix

{ 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;
# Configure PATH for all shells, including non-interactive ones
home.sessionPath = [
"${config.home.homeDirectory}/.local/bin"
"${config.home.homeDirectory}/.nix-profile/bin"
"/nix/var/nix/profiles/default/bin"
];
# Nix configuration
nix = {
enable = true;
package = pkgs.nix;
settings = {
experimental-features = ["nix-command" "flakes"];
warn-dirty = false;
};
};
# Set environment variables for all shells
home.sessionVariables = {
# Use bwrap for nix-portable
NP_RUNTIME = "bwrap";
# This is missing for some reason and breaks alls kinds of Maven compilations.
MAVEN_OPTS="-Duser.home=${config.home.homeDirectory}";
};
# Create SSH environment file for non-interactive sessions
# This helps with SSH commands that don't source profile files
home.file.".ssh/environment".text = ''
PATH=${config.home.homeDirectory}/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH
NIX_PATH=${config.home.homeDirectory}/.nix-defexpr/channels:nixpkgs=${config.home.homeDirectory}/.nix-defexpr/channels/nixpkgs
'';
# Packages to install
home.packages = with pkgs; [
nix
eza
ripgrep
];
# Bash configuration
programs.bash = {
enable = true;
enableCompletion = true;
# This is sourced by both interactive and non-interactive shells
# Critical for SSH non-interactive sessions
profileExtra = ''
# Ensure Nix paths are properly set up for all shells
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"
# Source nix environment if it exists
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi
'';
# This is only sourced by interactive shells
initExtra = ''
# Additional interactive shell settings can go here
'';
shellAliases = {
"hm-up" = "nix-portable nix run github:nix-community/home-manager/release-25.05 -- switch --refresh --flake 'git+https://g.t1.xyz/tb/nix-ebay-home.git#tbingmann'";
"np" = "nix-portable nix run nixpkgs#bashInteractive --offline";
};
# History configuration
historyControl = [
"erasedups"
"ignoredups"
"ignorespace"
];
historyFileSize = 1000000;
historySize = 1000000;
};
# Direnv configuration
programs.direnv = {
enable = true;
nix-direnv.enable = true;
# Add hook to .bashrc
enableBashIntegration = true;
};
}