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

@@ -74,4 +74,5 @@ The configuration includes:
1. **Installation of Nix packages**: The `nix` package itself, `nixpkgs-fmt`, and `nix-direnv` 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 2. **Nix experimental features**: Enables both `nix-command` and `flakes` by default
3. **PATH configuration**: Sets up proper Nix paths in the Bash environment 3. **PATH configuration**: Sets up proper Nix paths in the Bash environment
4. **direnv integration**: Configured to work with Nix for project-specific environments 4. **direnv integration**: Configured to work with Nix for project-specific environments
5. **SSH support**: Configured to ensure Nix tools are available in both interactive and non-interactive SSH sessions

View File

@@ -29,11 +29,16 @@
# Set environment variables for all shells # Set environment variables for all shells
home.sessionVariables = { home.sessionVariables = {
NIX_PATH = "${config.home.homeDirectory}/.nix-defexpr/channels:nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs"; NIX_PATH = "${config.home.homeDirectory}/.nix-defexpr/channels:nixpkgs=${config.home.homeDirectory}/.nix-defexpr/channels/nixpkgs";
# Pre-set NIX_SOURCED to avoid duplicate sourcing
NIX_SOURCED = "1";
}; };
# 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 # Packages to install
home.packages = with pkgs; [ home.packages = with pkgs; [
eza eza
@@ -44,19 +49,24 @@
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
# Bash initialization # This is sourced by both interactive and non-interactive shells
initExtra = '' # Critical for SSH non-interactive sessions
# Ensure Nix paths are properly set up 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 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" export NIX_PATH="$HOME/.nix-defexpr/channels:nixpkgs=$HOME/.nix-defexpr/channels/nixpkgs"
# Source nix environment if it exists and not already sourced # Source nix environment if it exists
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ] && [ -z "$NIX_SOURCED" ]; then if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
export NIX_SOURCED=1
. "$HOME/.nix-profile/etc/profile.d/nix.sh" . "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi fi
''; '';
# This is only sourced by interactive shells
initExtra = ''
# Additional interactive shell settings can go here
'';
shellAliases = { 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'"; "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'";
}; };