Skip to content

Instantly share code, notes, and snippets.

@emendir
Created May 20, 2024 10:34
Show Gist options
  • Save emendir/1e22351aaf45aa6b4f791e5af8597ad6 to your computer and use it in GitHub Desktop.
Save emendir/1e22351aaf45aa6b4f791e5af8597ad6 to your computer and use it in GitHub Desktop.
Install Hydrogen Plugin for Pulsar Editor in 2024

Install Hydrogen for Pulsar in 2024

Since the sunset of the Atom text editor, getting some of its plugins to work in its successor Pulsar has been a bit tricky.

For me the Hydrogen plugin was the most critical issue. After collection partial solutions from many forums, I compiled a script for manually installing it that has worked reliably for me for several months now, on both x86 and arm architectures.

Sorry for the delay in publishing, I hope this helps other Pulsar users.

Tested with Pulsar v1.109.0 on:

  • 64-bit x86 running Ubuntu-23
  • 64-bit arm (Raspberry Pi 5) running Ubuntu-23.10 & 24.0.4 LTS

Prerequisites:

  • git & curl
# on Debian-based systems
sudo apt -y install build-essential git curl
  • Pulsar:
    I prefer installing Pulsar via the nix-env pacakge manager, as it works on both x86 and arm64 architectures (e.g. Raspberry Pi).
# install nix-env
if command -v nix &> /dev/null; then
    echo "Skipping installation of nix, as it is already installed."
else
    # install nix package manager
    curl -L https://nixos.org/nix/install | sudo sh -s -- --daemon
    source /etc/profile  # load nix command into current shell session
    source .profile      # reload this console's profile on top of the /etc/profile
fi

# install pulsar
export NIXPKGS_ALLOW_INSECURE=1 && nix-env -iA nixpkgs.pulsar

Install Hydrogen-Plugin

# Install NVM and NPM to help build packages
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
nvm list-remote
nvm install --lts




## Hydrogen:
## The hydrogen package hasn't been updated since the sunset of Atom,
## and as of 2023-12-17 is broken when using with Pulsar.
## Here's how to install and fix it:

# delete old installation attempts
if [ -d ~/.pulsar/packages/hydrogen ] || [ -d ~/.pulsar/packages/Hydrogen ]; then 
  echo "Please allow sudo access to delete old Hydrogen installation attempts:"
  sudo rm -r ~/.pulsar/packages/hydrogen 2>/dev/null
  sudo rm -r ~/.pulsar/packages/Hydrogen 2>/dev/null
fi
# use Pulsar to install specific version of Hydrogen
pulsar -p install https://github.com/nteract/hydrogen.git -t v2.16.5
# rebuild Hydrogen with specific version of electron
electron_version=$(pulsar --version | grep 'Electron:' | awk '{print $2}')
org_dir=$(pwd)
cd ~/.pulsar/packages/Hydrogen 
npx --yes electron-rebuild --version $electron_version
cd $org_dir

Install Python kernel for Hydrogen

Option 1 (nix-env):

nix-env -iA nixpkgs.jupyter

Option 2 (pip):

python -m pip install ipykernel
python -m ipykernel install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment