How to Install Savepad on NixOS Latest

Savepad is a text editor built out of pure bash and it is available on Github. In this tutorial, we will go through the steps required to install savepad on a NixOS latest distribution.

Prerequisites

Before proceeding with the installation process, you need to ensure that the following prerequisites are satisfied.

  • A NixOS latest distribution is installed and running.
  • Internet connectivity is present.
  • Basic knowledge of bash commands and terminal usage.

Step 1: Install Git

The first step is to ensure that Git is installed on your NixOS latest distribution by running the following command in your terminal.

sudo nix-env -i git

Step 2: Clone Savepad's GitHub Repository

Next, we will clone the Savepad GitHub repository by executing the following command in your terminal:

git clone https://github.com/shelltr/textpad.git

This will download the Savepad files to a folder named textpad.

Step 3: Install Dependencies

Create a default.nix file in the textpad directory with the following content:

with import <nixpkgs> {};

stdenv.mkDerivation rec {
  name = "savepad";
  src = ./.;
  buildInputs = [
    bashInteractive
    coreutils
    diffutils
    findutils
    gawk
    gnu-sed
    grep
    tree
    unicodify
  ];
}

Then, in the textpad directory, run the following command:

sudo nix-env -f default.nix -i

This will install all the dependencies required to run savepad on your NixOS latest distribution.

Step 4: Add Savepad Path to Shell Environment

Add the path of the textpad/savepad script to your shell environment by running the following command:

echo "export PATH=\"$(pwd)/textpad:\${PATH}\"" >> ~/.bashrc

This will ensure that the savepad command can be executed from anywhere in the terminal.

Step 5: Verify Savepad Installation

Finally, let's verify that Savepad is correctly installed on your NixOS latest distribution.

Open your terminal and type the following command:

savepad

This will open Savepad and you can start using it to edit text files.

Congratulations! You have successfully installed Savepad on your NixOS latest distribution.