A decentralized (pseudo) package manager and script runner

nifty is a simple, self-contained program that can be used as a bare-bones, decentralized (pseudo) package manager and script runner.

It was born out of the necessity of building Nim programs with several dependencies like min or hastysite on machines with low memory (i.e. a VPS running x86 Linux with 500MB of RAM). The main problem was that on such low-end machine it may not even be possible to compile the Nimble package manager, because apparently it requires more RAM to compile than Nim itself.

Nimble offers a lot of features that proper package managers do, like dependency management, package creation and publishing, support for semantic versioning, etc. while nifty does not. Hence nifty is only a pseudo-package manager and script runner, but it could be useful in certain situations nonetheless.

Main features

In a nutshell, nifty is a program that executes user-defined scripts on a set of folders or files within a user-define package folder. It doesn’t do (almost) anything by itself, it just relies on other programs and utilities that are typically already available on your system like git and curl to do all the heavy-lifting.

Run side-by-side your existing package manager

nifty doesn’t claim to replace your existing package manager, therefore it tries not to get too much in the way of your existing project structure. All it needs to work resides in a humble nifty.json file that is used to:

  • keep track of what packages are part of the current project
  • provide the full definition of all the available commands and how to execute them on specific packages

The folder where packages will be stored is by default set to a packages subfolder within the current project directory, but even this can be configured in the nifty.json file.

Define your own packages

For nifty, a package can be a folder containing files, or even a single files. Through the nifty.json file, you can define:

  • The source of a package (typically a git repository or event just a URL).
  • Whether the package supports git, curl or any other command that will be used to retrieve its contents.

Define your own commands

You can use your nifty.json to teach nifty new tricks, i.e. how to execute new commands on packages. Your commands look like… well, CLI commands, except that you can use placeholders like {{name}} and {{src}} in them for your package name, source, etc.

Run on many different platforms and regardless of the type of project

nifty is a self-contained executable program written in Nim and runs on all platforms where Nim compiles. Also, unlike other package managers that are typically used within the context of one specific programming language (like NPM for Javascript or RubyGems for Ruby), nifty can be used in virtually any project, regardless of the programming language used.