Skip to content

Instantly share code, notes, and snippets.

@iwconfig
Created April 30, 2025 21:15
Show Gist options
  • Save iwconfig/60ad99a1ddc5e6d51bec5ab708a7d5d5 to your computer and use it in GitHub Desktop.
Save iwconfig/60ad99a1ddc5e6d51bec5ab708a7d5d5 to your computer and use it in GitHub Desktop.
Modified `pipx` executable for use within a Flatpak environment, setting up necessary environment variables to isolate `pipx` from the host system. Replace the content of `pipx` with `pipx-bin.py`.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import os
import sys
if __name__ == '__main__':
BASE_DIR = f'{os.environ['HOME']}/.var/app/com.vscodium.codium-insiders'
os.environ['PIPX_HOME'] = f'{BASE_DIR}/data/pipx'
os.environ['PIPX_BIN_DIR'] = f'{BASE_DIR}/data/python/bin' # This path is already in your PATH
os.environ['PIPX_MAN_DIR'] = f'{BASE_DIR}/.local/share/man' # You might need to create this path
from pipx.main import cli
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(cli())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment