Skip to content

Instantly share code, notes, and snippets.

@mthadley
Created March 29, 2020 00:31
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 mthadley/a92d508501890ac9e57df7277874d794 to your computer and use it in GitHub Desktop.
Save mthadley/a92d508501890ac9e57df7277874d794 to your computer and use it in GitHub Desktop.
Portable Nix/Ruby Web Server
#! /usr/bin/env nix-shell
#! nix-shell -i ruby -p ruby bundler --pure
#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.03.tar.gz
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem 'sinatra'
gem 'thin'
gem 'haml'
end
get '/' do
haml :index
end
Sinatra::Application.run!
__END__
@@ index
%h1
Hello World
@@ layout
%html
%head
%title= "My app"
%body
= yield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment