diff --git a/README.md b/README.md
index 0d0d0d4d..77f1c31d 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
[![Join the chat](https://badges.gitter.im/janet-language/community.svg)](https://gitter.im/janet-language/community)
+[![Appveyor Status](https://ci.appveyor.com/api/projects/status/bjraxrxexmt3sxyv/branch/master?svg=true)](https://ci.appveyor.com/project/bakpakin/janet/branch/master)
[![Build Status](https://travis-ci.org/janet-lang/janet.svg?branch=master)](https://travis-ci.org/janet-lang/janet)
-[![Appveyor Status](https://ci.appveyor.com/api/projects/status/32r7s2skrgm9ubva?svg=true)](https://ci.appveyor.com/project/janet-lang/janet)
[![builds.sr.ht status](https://builds.sr.ht/~bakpakin/janet/.freebsd.yaml.svg)](https://builds.sr.ht/~bakpakin/janet/.freebsd.yaml?)
diff --git a/src/core/corelib.c b/src/core/corelib.c
index d1f5ebac..546d2a32 100644
--- a/src/core/corelib.c
+++ b/src/core/corelib.c
@@ -753,7 +753,9 @@ JanetTable *janet_core_env(void) {
janet_lib_debug(env);
janet_lib_string(env);
janet_lib_marsh(env);
+#ifdef JANET_PEG
janet_lib_peg(env);
+#endif
#ifdef JANET_ASSEMBLER
janet_lib_asm(env);
#endif
diff --git a/src/core/peg.c b/src/core/peg.c
index 09ca7685..3ee04e6c 100644
--- a/src/core/peg.c
+++ b/src/core/peg.c
@@ -20,6 +20,8 @@
* IN THE SOFTWARE.
*/
+#ifdef JANET_PEG
+
#ifndef JANET_AMALG
#include
#include
@@ -1105,3 +1107,5 @@ static const JanetReg peg_cfuns[] = {
void janet_lib_peg(JanetTable *env) {
janet_core_cfuns(env, NULL, peg_cfuns);
}
+
+#endif /* ifdef JANET_PEG */
diff --git a/src/include/janet/janet.h b/src/include/janet/janet.h
index 46b807ba..680524e9 100644
--- a/src/include/janet/janet.h
+++ b/src/include/janet/janet.h
@@ -123,6 +123,11 @@ extern "C" {
#define JANET_ASSEMBLER
#endif
+/* Enable or disable the peg module */
+#ifndef JANET_NO_PEG
+#define JANET_PEG
+#endif
+
/* How to export symbols */
#ifndef JANET_API
#ifdef JANET_WINDOWS