Using Powershell in Nextjournal
This notebook is a proof-of-concept showing that it’s possible to install and run Powershell on Nextjournal. The result is not an interactive Powershell cell however because we are still working on allowing users to provide their own runtimes using the Nextjournal runtime protocol.
The following Bash cell installs Powershell on Ubuntu 18.04 based on the instructions provided by Microsoft. We then export the Bash cell’s runtime environment so that other cells can make use of it with Powershell already installed. This is done via runtime settings which can be opened in the sidebar in Nextjournal’s editor.
# Download the Microsoft repository GPG keys wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb # Register the Microsoft repository GPG keys dpkg -i packages-microsoft-prod.deb # Update the list of products apt-get update # Provide add-apt-repository sudo apt-get install -y software-properties-common # Enable the "universe" repositories add-apt-repository universe # Install PowerShell apt-get install -y powershell
Finally, we add another Bash cell and making it use our newly exported "Powershell" environment. Mind that this is not interactive in the typical sense of a shell at the moment but passing a Powershell command to
pwsh and running the cell works.
pwsh -Command "Write-Host 'Hello, Powershell!'"