Nasher: a command-line build tool for NWN development

Howdy all! nasher is a tool I’ve been working on to make it easier to do script and module development on the command-line. I think it’s finally close to beta, so it’s time to show it off and get feedback and requests.

Who

nasher is intended for script and module (and probably hak) developers who want to version-control their source code and build modules or erfs from those sources. It is not meant for casual users who just want to install a module to play.

As I do not have a Windows box to test on, nasher is currently Linux-only. It may compile and run correctly on Windows, but I can’t guarantee that. I’d love to have assistance here.

What

nasher is used to unpack an erf or module into a source tree, converting gff files into json format. Since json is a text-based format, it can be checked into git or another version-control system to track changes over time and make it easier for multiple people to work on the same project simultaneously. nasher can also rebuild the module or erf from those unpacked source files.

nasher is similar to nwn-devbase, but it has some key differences:

Advantages

  • nasher and the tools it uses are written in Nim rather than Ruby, so they should be much faster (handy for large projects) and can be distributed in binary form
  • nasher supports non-module projects (including erfs and haks)
  • nasher supports multiple build targets (e.g., an installable erf and a demo module)
  • nasher supports custom source tree layouts (e.g., dividing scripts into directories based on category)
  • nasher can install built targets into the NWN installation directory

Disadvantages

  • nasher has not (yet) been tested on Windows (help wanted)
  • nasher does not (yet) provide a containerized Docker build
  • nasher does not provide tools for local testing with Docker

Neutral

  • nasher uses json rather than yaml for storing gff files

How

Requirements

Installation

If you already have nim installed, you can install nasher through nimble:

$ nimble install nasher

Or by building from source:

$ git clone https://github.com/squattingmonk/nasher.nim.git nasher
$ cd nasher
$ nimble install

If nimble has been configured correctly, the binary should be available on
your path.

Usage

Detailed usage can be found in the readme or by running nasher --help, but here’s a crash course:

# Initialize the current directory as a nasher package
$ nasher init

# Initialize the directory demo using the contents of demo.mod
$ nasher init demo demo.mod

# List build targets
$ nasher list

# Convert, compile, and pack the default build target
$ nasher pack

# Pack and install the "demo" build target to the NWN installation directory
$ nasher install demo

# Unpack somefile.erf into the source tree
$ nasher unpack somefile.erf

Example

To see a project that uses nasher to build, check out the Core Framework.

2 Likes

Looks nice!

Not supporting yaml of course makes it a non-starter for anyone already using source control with the older tools :slight_smile:
But I’m happy with my scripted tooling anyway…

1 Like

nasher doesn’t support yaml because neverwinter.nim doesn’t support it on the main branch. Hopefully yaml support will be merged in soon.

Converting a source tree that uses yaml is pretty easy. Just pack the module with whatever tool you’re already using and unpack it with nasher. Setting up unpack rules can make it easier to get everything in the right place.

If you’re just using your scripted tools for your own development, you probably don’t need nasher. It’s more useful for people who want to develop and distribute scripts and modules by source (which is my use case) or don’t want to roll their own tools.

Yeah I know that about neverwinter.nim. I already hassled Niv about that :slight_smile:

Changing everything to a different text format effectively destroys all the history. Or at least makes it a lot harder to follow.

Yes, getting others to play nicely is harder. Before Hill’s edge died I was working to get them setup with the nwn-devbase thing but that was not an easy transition either. And they were all windows people so the commandline was somewhat alien to them.

Good stuff though :slight_smile:

1 Like