docs: move section "Use the Nix Package manager with Xonsh" from rc to platform tips and tricks (#5503)

<!---

Thanks for opening a PR on xonsh!

Please do this:

1. Include a news file with your PR
(https://xon.sh/devguide.html#changelog).
2. Add the documentation for your feature into `/docs`.
3. Add the example of usage or before-after behavior.
4. Mention the issue that this PR is addressing e.g. `#1234`.

-->

subj

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
This commit is contained in:
Andy Kipp 2024-06-15 18:31:50 +02:00 committed by GitHub
parent 40f5eea840
commit f9d2842fb1
Failed to generate hash of commit
3 changed files with 53 additions and 31 deletions

View file

@ -30,6 +30,36 @@ lines to your ``~/.bashrc file``:
unset module unset module
unset scl unset scl
Use the Nix Package manager with Xonsh
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To users of the `Nix Package Manager <https://www.nixos.org/>`_ 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 MacOS, OSX
---------- ----------

View file

@ -249,34 +249,3 @@ For a compact shell prompts, some people prefer a very condensed time format. Bu
get_shelldate.fulldate = 0 get_shelldate.fulldate = 0
$PROMPT_FIELDS['shelldate'] = get_shelldate $PROMPT_FIELDS['shelldate'] = get_shelldate
Use the Nix Package manager with Xonsh
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
To users of the `Nix Package Manager <https://www.nixos.org/>`_ 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`!

23
news/docs_nix.rst Normal file
View file

@ -0,0 +1,23 @@
**Added:**
* Added section "Use the Nix Package manager with Xonsh" to "Platform-specific tips and tricks".
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* <news item>
**Security:**
* <news item>