Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nh2 committed Jun 13, 2018
0 parents commit 29ea62b
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Main.hs
@@ -0,0 +1,10 @@
{-# LANGUAGE OverloadedStrings #-}

import Web.Scotty

import Data.Monoid (mconcat)

main = scotty 3000 $ do
get "/:word" $ do
beam <- param "word"
html $ mconcat ["<h1>Scotty, ", beam, " me up!</h1>"]
11 changes: 11 additions & 0 deletions blank-me-up.cabal
@@ -0,0 +1,11 @@
name: blank-me-up
version: 0.1.0.0
license: BSD3
build-type: Simple
cabal-version: >=1.10

executable blank-me-up
main-is: Main.hs
build-depends: base >=4.9 && <5
, scotty
default-language: Haskell2010
34 changes: 34 additions & 0 deletions default.nix
@@ -0,0 +1,34 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }:

let

inherit (nixpkgs) pkgs;

f = { mkDerivation, base, scotty, stdenv }:
mkDerivation {
pname = "blank-me-up";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
enableSharedExecutables = false;
enableSharedLibraries = false;
executableHaskellDepends = [ base scotty ];
license = stdenv.lib.licenses.bsd3;
configureFlags = [
"--ghc-option=-optl=-static"
"--ghc-option=-optl=-L${pkgs.gmp6.override { withStatic = true; }}/lib"
"--ghc-option=-optl=-L${pkgs.zlib.static}/lib"
"--ghc-option=-optl=-L${pkgs.glibc.static}/lib"
];
};

haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};

drv = haskellPackages.callPackage f {};

in

if pkgs.lib.inNixShell then drv.env else drv
12 changes: 12 additions & 0 deletions static.nix
@@ -0,0 +1,12 @@
let
pkgs = import <nixpkgs> {};
in pkgs.buildFHSUserEnv {
name = "fhs";
targetPkgs = pkgs: [
(pkgs.haskellPackages.ghcWithPackages (p: with p; [ cabal-install ]))
pkgs.gmp5.static
pkgs.glibc.static
pkgs.zlib.static
pkgs.zlib.dev
];
}

0 comments on commit 29ea62b

Please sign in to comment.