commit 17f571d5e7b8aa01dc35ef55be4010deb105f4fc
parent cfc3e62788cb93c71d1d47d9e3e66ff0876ad444
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Sat, 11 Jun 2022 02:20:29 +0300
Remove gmnisrv module
Diffstat:
4 files changed, 0 insertions(+), 128 deletions(-)
diff --git a/modules/default.nix b/modules/default.nix
@@ -1,5 +1,4 @@
{
- gmnisrv = ./services/gmnisrv.nix;
home-manager = {
programs = {
diff --git a/modules/services/gmnisrv.nix b/modules/services/gmnisrv.nix
@@ -1,95 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
- cfg = config.services.gmnisrv;
-in {
- options.services.gmnisrv = {
- enable = mkEnableOption "Simple Gemini protocol server";
-
- package = mkOption {
- type = types.package;
- default = pkgs.gmnisrv;
- defaultText = "pkgs.gmnisrv";
- description = "Which gmnisrv package to use.";
- };
-
- hostNames = mkOption {
- type = types.listOf types.str;
- default = [ ];
- example = [ "example.com" ];
- description = "List of hostnames to respond to requests for.";
- };
-
- port = mkOption {
- type = types.port;
- default = 1965;
- description = "TCP port for gmnisrv to bind to.";
- };
-
- user = mkOption {
- type = types.str;
- default = "gmnisrv";
- description = "User under which gmnisrv is ran.";
- };
-
- group = mkOption {
- type = types.str;
- default = "gmnisrv";
- description = "Group under which gmnisrv is ran.";
- };
-
- stateDir = mkOption {
- type = types.path;
- default = "/var/lib/gemini";
- description = "The gmnisrv home directory containing certificates.";
- };
-
- docBase = mkOption {
- type = types.str;
- default = "/srv/gemini";
- description = "Base directory for Gemini content.";
- }
- };
-
- config = mkIf cfg.enable {
- systemd.services.gmnisrv = {
- description = "Simple gemini server";
- after = [ "network.target" ];
- wantedBy = [ "multi-user.target" ];
- preStart = ''
- mkdir -p "${cfg.stateDir}/certs"
- '';
- serviceConfig = let
- configFile = pkgs.writeFile "gmnisrv.ini" ''
- listen=0.0.0.0:${cfg.port}
- [:tls]
- store=${cfg.stateDir}/certs
- '' + lib.concatMapStringsSep "\n" (hostname: ''
- [${hostname}]
- root=${cfg.docBase}/${hostname}
- '') cfg.hostNames;
- in {
- User = cfg.user;
- Group = cfg.group;
- LogsDirectory = "gmnisrv";
- ExecStart = "${cfg.package}/bin/gmnisrv -C ${configFile}";
- Restart = "always";
- };
- };
-
- users.users = optionalAttrs (cfg.user == "gmnisrv") {
- gmnisrv = {
- group = cfg.group;
- home = cfg.stateDir;
- createHome = true;
- uid = config.ids.uids.gmnisrv;
- };
- };
-
- users.groups = optionalAttrs (cfg.group == "gmnisrv") {
- gmnisrv.gid = config.ids.gids.gmnisrv;
- };
- };
-}
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -246,7 +246,6 @@ 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/images/gmnisrv/default.nix b/pkgs/images/gmnisrv/default.nix
@@ -1,31 +0,0 @@
-{ 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" = { };
- };
- };
-}