GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — $PATH Pollution on NixOS · Issue #979 · tmux-python/tmuxp

$PATH Pollution on NixOS #979

New issue
Copy link
New issue
Copy link
Open
Open
$PATH Pollution on NixOS#979
Copy link

Description

@CuboidRaptor
CuboidRaptor
opened on Apr 26, 2025
Issue body actions

Version Information:

  • Linux NixOS 25.05 (Warbler) x86_64
  • tmuxp 1.50.1
  • tmux 3.5a
  • Bash 5.2.37(1)-release

When loading tmuxp sessions, $PATH gets polluted with paths to python and tmuxp. For example, when I load a session, echo "$PATH" prints /nix/store/fqm9bqqlmaqqr02qbalm1bazp810qfiw-python3-3.12.9/bin:/nix/store/y2r9mrjwnjbj2mqai0949am04z6ckw4g-tmuxp-1.50.1/bin before my usual $PATH. These paths are where Nix stores tmuxp's binaries as well as the binaries for the version of python it uses.

This only happens when I load with tmuxp. Just using tmux new does not cause this bug. It also doesn't happen outside of tmux.
This happens with a completely blank tmux config that has nothing except for set-option -g default-shell /<...>/shellbin, where shellbin is a bash script I created that runs bash with --noprofile and --norc.
Essentially, a blank tmux and bash config.
This bug happens with both my custom tmuxp sessions and also the example on the README.md

Should be able to reproduce with tmuxp load mysession with ~/.tmuxp/mysession.yaml containing the example from the README.md with no bash/tmux config on NixOS

Activity

  1. CuboidRaptor commented on May 28, 2025

    @CuboidRaptor
    CuboidRaptor
    on May 28, 2025
    Author
    More actions

    My current incredibly scuffed solution:

    #!/usr/bin/env bash
    
    set -o pipefail
    
    # run zsh in a blank login shell and set $PATH to that $PATH
    # this basically sets $PATH to how it would be in a new login shell
    # (it's a patch for tmuxp's weird behaviour)
    # and also set $SHELL to login default cuz that's get screwed up too
    defaultpath="$(env -i HOME="$HOME" zsh --login -c 'echo "$PATH"')" \
        && export PATH="$defaultpath" \
        && defaultshell="$(getent passwd "$USER" | awk -F: '{print $NF}')" \
        && export SHELL="$defaultshell" \
        && exec -a "zsh" zsh "$@" # set $0
    

    It basically runs an extra login shell to get the correct $PATH and sets it to the correct value before invoking zsh. Using bash is probably similar. (It also gets the correct value of $SHELL because that breaks too for some reason) I just use this script as tmux default-shell instead of zsh.
    However, this is really cursed and an actual solution would probably be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.