Git Product home page Git Product logo

heroku-buildpack-nim's Introduction

Heroku Buildpack for Nim

This is a Heroku-compatible buildpack for Nim apps. It uses Nimble for dependency management.

Currently supports Nim version 1.0 and upwards.

Example

$ tree
.
├── Procfile
├── app.nimble
└── src
    └── app.nim

$ heroku create --buildpack https://github.com/vic/heroku-buildpack-nim.git
Creating your-app-1234
...

$ git push heroku master
...

Minimum .nimble file:

# Package

version       = "0.1.0"
author        = "John Doe"
description   = "my next great API"
license       = "MIT"
srcDir        = "src"
bin           = @["app"]

# Dependencies

requires "nim >= 1.0.2", "jester >= 0.4.3"

Usage

The buildpack expects you to include a .nimble file in order to download dependencies and build your app.

Be sure to set the bin value on your nimble file to the executable name for your app.

And create a Procfile with a process to run for your executable. Should be the same binary that you defined in the bin setting of your .nimble file:

web: ./app

Create an app using this buildpack

heroku create --buildpack https://github.com/vic/heroku-buildpack-nim.git

Nim version

Since Nim's master branch is deprecated, you have to define the branch of the Nim version that should be installed by this buildpack.

This buildpack was tested with Nim version 1.0:

heroku config:set NIM_BRANCH=version-1-0

You can use the most recent development version this way:

heroku config:set NIM_BRANCH=devel

Example

An example nimble app lives here

heroku-buildpack-nim's People

Contributors

louis77 avatar metagn avatar vic avatar yglukhov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heroku-buildpack-nim's Issues

Example app build fails

Thanks so much for making this buildpack! It's not working at the moment:

Nim seems to fail to build:

remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/cgen.nim.c -o c_code/1_2/cgen.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/passaux.nim.c -o c_code/1_2/passaux.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/depends.nim.c -o c_code/1_2/depends.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/modules.nim.c -o c_code/1_2/modules.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/jsgen.nim.c -o c_code/1_2/jsgen.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/2_2/docgen2.nim.c -o c_code/2_2/docgen2.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/main.nim.c -o c_code/1_2/main.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/2_2/scriptconfig.nim.c -o c_code/2_2/scriptconfig.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/2_2/cmdlinehelper.nim.c -o c_code/2_2/cmdlinehelper.nim.o
remote: gcc -w -O3 -fno-strict-aliasing -Ic_code -c c_code/2_2/nim.nim.c -o c_code/2_2/nim.nim.o
remote: gcc -o ../bin/nim c_code/1_2/stdlib_assertions.nim.o c_code/1_2/stdlib_dollars.nim.o c_code/2_2/stdlib_io.nim.o c_code/2_2/stdlib_system.nim.o c_code/2_2/stdlib_parseutils.nim.o c_code/2_2/stdlib_math.nim.o c_code/1_2/stdlib_algorithm.nim.o c_code/2_2/stdlib_unicode.nim.o c_code/2_2/stdlib_strutils.nim.o c_code/2_2/stdlib_pathnorm.nim.o c_code/2_2/stdlib_posix.nim.o c_code/2_2/stdlib_times.nim.o c_code/2_2/stdlib_os.nim.o c_code/1_2/stdlib_hashes.nim.o c_code/1_2/stdlib_strtabs.nim.o c_code/2_2/stdlib_streams.nim.o c_code/2_2/stdlib_cpuinfo.nim.o c_code/2_2/stdlib_osproc.nim.o c_code/1_2/stdlib_sets.nim.o c_code/2_2/pathutils.nim.o c_code/1_2/ropes.nim.o c_code/1_2/stdlib_tables.nim.o c_code/1_2/lineinfos.nim.o c_code/2_2/platform.nim.o c_code/1_2/prefixmatches.nim.o c_code/2_2/stdlib_strformat.nim.o c_code/2_2/stdlib_terminal.nim.o c_code/2_2/options.nim.o c_code/2_2/msgs.nim.o c_code/1_2/wordrecg.nim.o c_code/1_2/idents.nim.o c_code/1_2/condsyms.nim.o c_code/1_2/stdlib_sha1.nim.o c_code/2_2/stdlib_lexbase.nim.o c_code/1_2/stdlib_parsejson.nim.o c_code/2_2/stdlib_json.nim.o c_code/2_2/extccomp.nim.o c_code/2_2/nimblecmd.nim.o c_code/2_2/stdlib_parseopt.nim.o c_code/2_2/commands.nim.o c_code/1_2/llstream.nim.o c_code/1_2/nimlexbase.nim.o c_code/2_2/lexer.nim.o c_code/2_2/nimconf.nim.o c_code/1_2/stdlib_intsets.nim.o c_code/1_2/idgen.nim.o c_code/1_2/ast.nim.o c_code/1_2/rodutils.nim.o c_code/2_2/astalgo.nim.o c_code/1_2/parser.nim.o c_code/1_2/renderer.nim.o c_code/1_2/filters.nim.o c_code/1_2/filter__tmpl.nim.o c_code/1_2/syntaxes.nim.o c_code/1_2/trees.nim.o c_code/2_2/types.nim.o c_code/1_2/treetab.nim.o c_code/1_2/incremental.nim.o c_code/1_2/btrees.nim.o c_code/1_2/stdlib_md5.nim.o c_code/1_2/modulegraphs.nim.o c_code/1_2/magicsys.nim.o c_code/1_2/bitsets.nim.o c_code/1_2/nimsets.nim.o c_code/2_2/semfold.nim.o c_code/2_2/modulepaths.nim.o c_code/1_2/reorder.nim.o c_code/1_2/passes.nim.o c_code/1_2/vmdef.nim.o c_code/1_2/semdata.nim.o c_code/1_2/linter.nim.o c_code/1_2/nimfix7prettybase.nim.o c_code/1_2/lookups.nim.o c_code/1_2/semtypinst.nim.o c_code/1_2/parampatterns.nim.o c_code/1_2/lowerings.nim.o c_code/1_2/_7lib7packages7docutils7rstast.nim.o c_code/1_2/_7lib7packages7docutils7rst.nim.o c_code/1_2/_7lib7packages7docutils7highlite.nim.o c_code/2_2/_7lib7packages7docutils7rstgen.nim.o c_code/1_2/stdlib_xmltree.nim.o c_code/1_2/stdlib_uri.nim.o c_code/1_2/stdlib_cgi.nim.o c_code/1_2/typesrenderer.nim.o c_code/2_2/docgen.nim.o c_code/2_2/sigmatch.nim.o c_code/1_2/importer.nim.o c_code/1_2/procfind.nim.o c_code/2_2/pragmas.nim.o c_code/1_2/saturate.nim.o c_code/1_2/guards.nim.o c_code/1_2/sighashes.nim.o c_code/1_2/sempass2.nim.o c_code/1_2/cgmeth.nim.o c_code/1_2/aliases.nim.o c_code/1_2/patterns.nim.o c_code/1_2/dfa.nim.o c_code/1_2/injectdestructors.nim.o c_code/1_2/liftlocals.nim.o c_code/1_2/lambdalifting.nim.o c_code/1_2/closureiters.nim.o c_code/1_2/transf.nim.o c_code/1_2/vmgen.nim.o c_code/2_2/vmdeps.nim.o c_code/1_2/vmmarshal.nim.o c_code/2_2/gorgeimpl.nim.o c_code/1_2/macrocacheimpl.nim.o c_code/1_2/evaltempl.nim.o c_code/2_2/vm.nim.o c_code/1_2/semmacrosanity.nim.o c_code/1_2/pluginsupport.nim.o c_code/1_2/plugins7locals.nim.o c_code/1_2/plugins7itersgen.nim.o c_code/1_2/plugins7active.nim.o c_code/1_2/semparallel.nim.o c_code/2_2/sem.nim.o c_code/1_2/ccgutils.nim.o c_code/1_2/ndi.nim.o c_code/1_2/cgendata.nim.o c_code/1_2/ccgmerge.nim.o c_code/1_2/enumtostr.nim.o c_code/2_2/stdlib_dynlib.nim.o c_code/1_2/cgen.nim.o c_code/1_2/passaux.nim.o c_code/1_2/depends.nim.o c_code/1_2/modules.nim.o c_code/1_2/jsgen.nim.o c_code/2_2/docgen2.nim.o c_code/1_2/main.nim.o c_code/2_2/scriptconfig.nim.o c_code/2_2/cmdlinehelper.nim.o c_code/2_2/nim.nim.o -ldl -lm -lrt
remote: : SUCCESS
remote: 
remote: cp bin/nim bin/nim_csources
remote: 
remote: bin/nim c koch
remote: Hint: used config file '/app/tmp/cache/Nim/config/nim.cfg' [Conf]
remote: Hint: used config file 'koch.nim.cfg' [Conf]
remote: Hint: system [Processing]
remote: /app/tmp/cache/Nim/lib/system.nim(207, 11) Error: undeclared identifier: 'is'
remote:  !     Push rejected, failed to compile Nim app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !	Push rejected to quiet-headland-10002.
remote: 

As there's no way we should be building Nim every time, the solution is easy: use a prebuilt Nim binary. The ruby buildpack doesn't build ruby each time, neither should this.

Reuse Nim Installation

@vic I have been trying out this buildpack, and it seems to re-clone and re-build Nim from every push to the server, maybe we could reuse previous installation not to torture the server?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.