1
0

try to fix PATH

This commit is contained in:
Timo Bingmann
2025-07-09 14:38:45 -07:00
parent 1e30095098
commit a473e73202
2 changed files with 21 additions and 10 deletions

View File

@@ -29,11 +29,16 @@
# Set environment variables for all shells
home.sessionVariables = {
NIX_PATH = "${config.home.homeDirectory}/.nix-defexpr/channels:nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs";
# Pre-set NIX_SOURCED to avoid duplicate sourcing
NIX_SOURCED = "1";
NIX_PATH = "${config.home.homeDirectory}/.nix-defexpr/channels:nixpkgs=${config.home.homeDirectory}/.nix-defexpr/channels/nixpkgs";
};
# 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; [
eza
@@ -44,19 +49,24 @@
enable = true;
enableCompletion = true;
# Bash initialization
initExtra = ''
# Ensure Nix paths are properly set up
# 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 and not already sourced
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ] && [ -z "$NIX_SOURCED" ]; then
export NIX_SOURCED=1
# 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 run github:nix-community/home-manager/release-25.05 -- switch --no-write-lock-file --refresh --flake 'git+https://g.t1.xyz/tb/nix-ebay-home.git#tbingmann'";
};