nixos/merecat: init

+96
+7
nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
··· 367 367 </listitem> 368 368 <listitem> 369 369 <para> 370 + <link xlink:href="https://troglobit.com/projects/merecat/">merecat</link>, 371 + a small and easy HTTP server based on thttpd. Available as 372 + <link linkend="opt-services.merecat.enable">services.merecat</link> 373 + </para> 374 + </listitem> 375 + <listitem> 376 + <para> 370 377 <link xlink:href="https://github.com/L11R/go-autoconfig">go-autoconfig</link>, 371 378 IMAP/SMTP autodiscover server. Available as 372 379 <link linkend="opt-services.go-autoconfig.enable">services.go-autoconfig</link>.
+2
nixos/doc/manual/release-notes/rl-2211.section.md
··· 123 123 124 124 - [expressvpn](https://www.expressvpn.com), the CLI client for ExpressVPN. Available as [services.expressvpn](#opt-services.expressvpn.enable). 125 125 126 + - [merecat](https://troglobit.com/projects/merecat/), a small and easy HTTP server based on thttpd. Available as [services.merecat](#opt-services.merecat.enable) 127 + 126 128 - [go-autoconfig](https://github.com/L11R/go-autoconfig), IMAP/SMTP autodiscover server. Available as [services.go-autoconfig](#opt-services.go-autoconfig.enable). 127 129 128 130 - [tmate-ssh-server](https://github.com/tmate-io/tmate-ssh-server), server side part of [tmate](https://tmate.io/). Available as [services.tmate-ssh-server](#opt-services.tmate-ssh-server.enable).
+1
nixos/modules/module-list.nix
··· 1155 1155 ./services/web-servers/lighttpd/collectd.nix 1156 1156 ./services/web-servers/lighttpd/default.nix 1157 1157 ./services/web-servers/lighttpd/gitweb.nix 1158 + ./services/web-servers/merecat.nix 1158 1159 ./services/web-servers/mighttpd2.nix 1159 1160 ./services/web-servers/minio.nix 1160 1161 ./services/web-servers/molly-brown.nix
+55
nixos/modules/services/web-servers/merecat.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + cfg = config.services.merecat; 7 + format = pkgs.formats.keyValue { 8 + mkKeyValue = generators.mkKeyValueDefault { 9 + mkValueString = v: 10 + # In merecat.conf, booleans are "true" and "false" 11 + if builtins.isBool v 12 + then if v then "true" else "false" 13 + else generators.mkValueStringDefault {} v; 14 + } "="; 15 + }; 16 + configFile = format.generate "merecat.conf" cfg.settings; 17 + 18 + in { 19 + 20 + options.services.merecat = { 21 + 22 + enable = mkEnableOption (lib.mdDoc "Merecat HTTP server"); 23 + 24 + settings = mkOption { 25 + inherit (format) type; 26 + default = { }; 27 + description = lib.mdDoc '' 28 + Merecat configuration. Refer to merecat(8) for details on supported values. 29 + ''; 30 + example = { 31 + hostname = "localhost"; 32 + port = 8080; 33 + virtual-host = true; 34 + directory = "/srv/www"; 35 + }; 36 + }; 37 + 38 + }; 39 + 40 + config = mkIf cfg.enable { 41 + 42 + systemd.services.merecat = { 43 + description = "Merecat HTTP server"; 44 + after = [ "network.target" ]; 45 + wantedBy = [ "multi-user.target" ]; 46 + serviceConfig = { 47 + DynamicUser = true; 48 + ExecStart = "${pkgs.merecat}/bin/merecat -n -f ${configFile}"; 49 + AmbientCapabilities = lib.mkIf ((cfg.settings.port or 80) < 1024) [ "CAP_NET_BIND_SERVICE" ]; 50 + }; 51 + }; 52 + 53 + }; 54 + 55 + }
+1
nixos/tests/all-tests.nix
··· 368 368 mediawiki = handleTest ./mediawiki.nix {}; 369 369 meilisearch = handleTest ./meilisearch.nix {}; 370 370 memcached = handleTest ./memcached.nix {}; 371 + merecat = handleTest ./merecat.nix {}; 371 372 metabase = handleTest ./metabase.nix {}; 372 373 minecraft = handleTest ./minecraft.nix {}; 373 374 minecraft-server = handleTest ./minecraft-server.nix {};
+28
nixos/tests/merecat.nix
··· 1 + import ./make-test-python.nix ({ pkgs, ... }: { 2 + name = "merecat"; 3 + meta = with pkgs.lib.maintainers; { 4 + maintainers = [ fgaz ]; 5 + }; 6 + 7 + nodes.machine = { config, pkgs, ... }: { 8 + services.merecat = { 9 + enable = true; 10 + settings = { 11 + hostname = "localhost"; 12 + virtual-host = true; 13 + directory = toString (pkgs.runCommand "merecat-webdir" {} '' 14 + mkdir -p $out/foo.localhost $out/bar.localhost 15 + echo '<h1>Hello foo</h1>' > $out/foo.localhost/index.html 16 + echo '<h1>Hello bar</h1>' > $out/bar.localhost/index.html 17 + ''); 18 + }; 19 + }; 20 + }; 21 + 22 + testScript = '' 23 + machine.wait_for_unit("merecat") 24 + machine.wait_for_open_port(80) 25 + machine.succeed("curl --fail foo.localhost | grep 'Hello foo'") 26 + machine.succeed("curl --fail bar.localhost | grep 'Hello bar'") 27 + ''; 28 + })
+2
pkgs/servers/http/merecat/default.nix
··· 7 7 , libxcrypt 8 8 , testers 9 9 , merecat 10 + , nixosTests 10 11 }: 11 12 12 13 stdenv.mkDerivation rec { ··· 36 37 package = merecat; 37 38 command = "merecat -V"; 38 39 }; 40 + inherit (nixosTests) merecat; 39 41 }; 40 42 41 43 meta = with lib; {