From f9d2842fb1a0c8b30cd92493bede982694ca8b3a Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Sat, 15 Jun 2024 18:31:50 +0200 Subject: [PATCH] docs: move section "Use the Nix Package manager with Xonsh" from rc to platform tips and tricks (#5503) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit subj ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> --- docs/platform-issues.rst | 30 ++++++++++++++++++++++++++++++ docs/xonshrc.rst | 31 ------------------------------- news/docs_nix.rst | 23 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 news/docs_nix.rst diff --git a/docs/platform-issues.rst b/docs/platform-issues.rst index d2fe7ccf1..b16556b46 100644 --- a/docs/platform-issues.rst +++ b/docs/platform-issues.rst @@ -30,6 +30,36 @@ lines to your ``~/.bashrc file``: unset module unset scl +Use the Nix Package manager with Xonsh +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +To users of the `Nix Package Manager `_ these few lines might be life-savers: + +.. code-block:: xonshcon + + import os.path + if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"): + $NIX_REMOTE="daemon" + $NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER + $NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile" + $NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + $NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels" + $PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"] + +Btw. a hacky solution to install xontribs that do not yet ship with ``nixpkgs`` is: + +.. code-block:: xonshcon + + for p in map(lambda s: str(s.resolve()), p"~/.local/lib/".glob("python*/site-packages")): + if p not in sys.path: + sys.path.append(p) + + $PYTHONPATH = "$USER/.local/lib/python3.7/site-packages" + + python -m ensurepip --user + xonsh + python -m pip install --user -U pip xontrib-z xonsh-direnv + +Just run the last three lines, do not put them in your `xonshrc`! MacOS, OSX ---------- diff --git a/docs/xonshrc.rst b/docs/xonshrc.rst index e9b9c22d8..3a086e391 100644 --- a/docs/xonshrc.rst +++ b/docs/xonshrc.rst @@ -249,34 +249,3 @@ For a compact shell prompts, some people prefer a very condensed time format. Bu get_shelldate.fulldate = 0 $PROMPT_FIELDS['shelldate'] = get_shelldate - -Use the Nix Package manager with Xonsh -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -To users of the `Nix Package Manager `_ these few lines might be life-savers: - -.. code-block:: xonshcon - - import os.path - if os.path.exists(f"{$HOME}/.nix-profile") and not __xonsh__.env.get("NIX_PATH"): - $NIX_REMOTE="daemon" - $NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/" + $USER - $NIX_PROFILES="/nix/var/nix/profiles/default " + $HOME + "/.nix-profile" - $NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" - $NIX_PATH="nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels" - $PATH += [f"{$HOME}/.nix-profile/bin", "/nix/var/nix/profiles/default/bin"] - -Btw. a hacky solution to install xontribs that do not yet ship with ``nixpkgs`` is: - -.. code-block:: xonshcon - - for p in map(lambda s: str(s.resolve()), p"~/.local/lib/".glob("python*/site-packages")): - if p not in sys.path: - sys.path.append(p) - - $PYTHONPATH = "$USER/.local/lib/python3.7/site-packages" - - python -m ensurepip --user - xonsh - python -m pip install --user -U pip xontrib-z xonsh-direnv - -Just run the last three lines, do not put them in your `xonshrc`! diff --git a/news/docs_nix.rst b/news/docs_nix.rst new file mode 100644 index 000000000..7090d2442 --- /dev/null +++ b/news/docs_nix.rst @@ -0,0 +1,23 @@ +**Added:** + +* Added section "Use the Nix Package manager with Xonsh" to "Platform-specific tips and tricks". + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*