commit 57df03994d2433f9e60f7d0d582f789546f99b01
parent e027e50eca980c0788958ef9cce842ffb99a2474
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date: Thu, 4 Feb 2021 13:34:33 +0300
Add docker-gmnisrv
Diffstat:
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -222,6 +222,7 @@ lib.makeScope newScope (
nlsSupport = false;
};
};
+ gmnisrv = callPackage ./images/gmnisrv { };
mbtileserver = callPackage ./images/mbtileserver { };
quark = callPackage ./images/quark { };
wekan = callPackage ./images/wekan { };
diff --git a/pkgs/gemini/gmnisrv/default.nix b/pkgs/gemini/gmnisrv/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, openssl, pkg-config, scdoc }:
+{ stdenv, fetchgit, mailcap, openssl, pkg-config, scdoc }:
stdenv.mkDerivation {
pname = "gmnisrv";
@@ -14,6 +14,10 @@ stdenv.mkDerivation {
buildInputs = [ openssl ];
+ configureFlags = [
+ "--with-mimedb=${mailcap}/etc/mime.types"
+ ];
+
meta = with stdenv.lib; {
description = "Simple Gemini protocol server";
homepage = "https://git.sr.ht/~sircmpwn/gmnisrv";
diff --git a/pkgs/images/gmnisrv/default.nix b/pkgs/images/gmnisrv/default.nix
@@ -0,0 +1,31 @@
+{ dockerTools, writeText, gmnisrv, domain ? "localhost" }:
+
+let
+ cfg = writeText "gmnisrv.ini" ''
+ listen=0.0.0.0:1965 [::]:1965
+
+ [:tls]
+ store=/certs
+
+ [${domain}]
+ root=/gemini
+ '';
+in
+dockerTools.buildImage {
+ name = "gmnisrv";
+ tag = gmnisrv.version;
+
+ contents = [ gmnisrv ];
+ runAsRoot = "mkdir -p /certs /gemini";
+
+ config = {
+ Cmd = [ "gmnisrv" "-C" cfg ];
+ Volumes = {
+ "/certs" = { };
+ "/gemini" = { };
+ };
+ ExposedPorts = {
+ "1965/tcp" = { };
+ };
+ };
+}