Merge pull request #135121 from vtuan10/fluidd-module

nixos/fluidd: init service at 1.16.2
This commit is contained in:
Bernardo Meurer 2021-08-21 22:02:34 +00:00 committed by GitHub
commit 16945c60bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 0 deletions

View file

@ -182,6 +182,16 @@
</para>
</listitem>
</itemizedlist>
<itemizedlist spacing="compact">
<listitem>
<para>
<link xlink:href="https://docs.fluidd.xyz/">fluidd</link>, a
Klipper web interface for managing 3d printers using
moonraker. Available as
<link linkend="opt-services.fluidd.enable">fluidd</link>.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-incompatibilities">
<title>Backward Incompatibilities</title>

View file

@ -56,6 +56,8 @@ pt-services.clipcat.enable).
* [navidrome](https://www.navidrome.org/), a personal music streaming server with
subsonic-compatible api. Available as [navidrome](#opt-services.navidrome.enable).
- [fluidd](https://docs.fluidd.xyz/), a Klipper web interface for managing 3d printers using moonraker. Available as [fluidd](#opt-services.fluidd.enable).
## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
- The `paperless` module and package have been removed. All users should migrate to the

View file

@ -953,6 +953,7 @@
./services/web-apps/documize.nix
./services/web-apps/dokuwiki.nix
./services/web-apps/engelsystem.nix
./services/web-apps/fluidd.nix
./services/web-apps/galene.nix
./services/web-apps/gerrit.nix
./services/web-apps/gotify-server.nix

View file

@ -0,0 +1,64 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.fluidd;
moonraker = config.services.moonraker;
in
{
options.services.fluidd = {
enable = mkEnableOption "Fluidd, a Klipper web interface for managing your 3d printer";
package = mkOption {
type = types.package;
description = "Fluidd package to be used in the module";
default = pkgs.fluidd;
defaultText = "pkgs.fluidd";
};
hostName = mkOption {
type = types.str;
default = "localhost";
description = "Hostname to serve fluidd on";
};
nginx = mkOption {
type = types.submodule
(import ../web-servers/nginx/vhost-options.nix { inherit config lib; });
default = { };
example = {
serverAliases = [ "fluidd.\${config.networking.domain}" ];
};
description = "Extra configuration for the nginx virtual host of fluidd.";
};
};
config = mkIf cfg.enable {
services.nginx = {
enable = true;
upstreams.fluidd-apiserver.servers."${moonraker.address}:${toString moonraker.port}" = { };
virtualHosts."${cfg.hostName}" = mkMerge [
cfg.nginx
{
root = mkForce "${cfg.package}/share/fluidd/htdocs";
locations = {
"/" = {
index = "index.html";
tryFiles = "$uri $uri/ /index.html";
};
"/index.html".extraConfig = ''
add_header Cache-Control "no-store, no-cache, must-revalidate";
'';
"/websocket" = {
proxyWebsockets = true;
proxyPass = "http://fluidd-apiserver/websocket";
};
"~ ^/(printer|api|access|machine|server)/" = {
proxyWebsockets = true;
proxyPass = "http://fluidd-apiserver$request_uri";
};
};
}
];
};
};
}

View file

@ -136,6 +136,7 @@ in
fish = handleTest ./fish.nix {};
flannel = handleTestOn ["x86_64-linux"] ./flannel.nix {};
fluentd = handleTest ./fluentd.nix {};
fluidd = handleTest ./fluidd.nix {};
fontconfig-default-fonts = handleTest ./fontconfig-default-fonts.nix {};
freeswitch = handleTest ./freeswitch.nix {};
fsck = handleTest ./fsck.nix {};

21
nixos/tests/fluidd.nix Normal file
View file

@ -0,0 +1,21 @@
import ./make-test-python.nix ({ lib, ... }:
with lib;
{
name = "fluidd";
meta.maintainers = with maintainers; [ vtuan10 ];
nodes.machine = { pkgs, ... }: {
services.fluidd = {
enable = true;
};
};
testScript = ''
machine.start()
machine.wait_for_unit("nginx.service")
machine.wait_for_open_port(80)
machine.succeed("curl -sSfL http://localhost/ | grep 'fluidd'")
'';
})