Skip to content

Instantly share code, notes, and snippets.

@jpf
Created June 1, 2016 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpf/f27c584c7d7f7cf4d53583f70e6c3742 to your computer and use it in GitHub Desktop.
Save jpf/f27c584c7d7f7cf4d53583f70e6c3742 to your computer and use it in GitHub Desktop.
A Python script that uses Nix to automatically bootstrap dependencies.
#! /usr/bin/env nix-shell
#! nix-shell -i python -p python27Packages.flask python27Packages.emoji
#
# This is a demo of using Nix to manage packages for a program in a language agnostic way.
# If you run this example as an executable, it'll Just Work, even if you don't have Flask or emoji installed. Try it out!
#
# $ curl https://nixos.org/nix/install | sh
# $ chmod a+x nix_and_python.py
# $ ./nix_and_python.py
from flask import Flask
import emoji
app = Flask(__name__)
@app.route("/")
def hello():
return emoji.emojize('Python and Nix is :thumbs_up_sign:')
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment