mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
nixos/fider: init
Co-authored-by: Niklas Korz <niklas@niklaskorz.de>
This commit is contained in:
parent
2ee9c181c5
commit
54e48b64d1
6 changed files with 170 additions and 0 deletions
|
@ -99,6 +99,8 @@
|
||||||
|
|
||||||
- [Zipline](https://zipline.diced.sh/), a ShareX/file upload server that is easy to use, packed with features, and with an easy setup. Available as [services.zipline](#opt-services.zipline.enable).
|
- [Zipline](https://zipline.diced.sh/), a ShareX/file upload server that is easy to use, packed with features, and with an easy setup. Available as [services.zipline](#opt-services.zipline.enable).
|
||||||
|
|
||||||
|
- [Fider](https://fider.io/), an open platform to collect and prioritize feedback. Available as [services.fider](#opt-services.fider.enable).
|
||||||
|
|
||||||
- [mqtt-exporter](https://github.com/kpetremann/mqtt-exporter/), a Prometheus exporter for exposing messages from MQTT. Available as [services.prometheus.exporters.mqtt](#opt-services.prometheus.exporters.mqtt.enable).
|
- [mqtt-exporter](https://github.com/kpetremann/mqtt-exporter/), a Prometheus exporter for exposing messages from MQTT. Available as [services.prometheus.exporters.mqtt](#opt-services.prometheus.exporters.mqtt.enable).
|
||||||
|
|
||||||
- [nvidia-gpu](https://github.com/utkuozdemir/nvidia_gpu_exporter), a Prometheus exporter that scrapes `nvidia-smi` for GPU metrics. Available as [services.prometheus.exporters.nvidia-gpu](#opt-services.prometheus.exporters.nvidia-gpu.enable).
|
- [nvidia-gpu](https://github.com/utkuozdemir/nvidia_gpu_exporter), a Prometheus exporter that scrapes `nvidia-smi` for GPU metrics. Available as [services.prometheus.exporters.nvidia-gpu](#opt-services.prometheus.exporters.nvidia-gpu.enable).
|
||||||
|
|
|
@ -1474,6 +1474,7 @@
|
||||||
./services/web-apps/eintopf.nix
|
./services/web-apps/eintopf.nix
|
||||||
./services/web-apps/engelsystem.nix
|
./services/web-apps/engelsystem.nix
|
||||||
./services/web-apps/ethercalc.nix
|
./services/web-apps/ethercalc.nix
|
||||||
|
./services/web-apps/fider.nix
|
||||||
./services/web-apps/filesender.nix
|
./services/web-apps/filesender.nix
|
||||||
./services/web-apps/firefly-iii.nix
|
./services/web-apps/firefly-iii.nix
|
||||||
./services/web-apps/firefly-iii-data-importer.nix
|
./services/web-apps/firefly-iii-data-importer.nix
|
||||||
|
|
124
nixos/modules/services/web-apps/fider.nix
Normal file
124
nixos/modules/services/web-apps/fider.nix
Normal file
|
@ -0,0 +1,124 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.fider;
|
||||||
|
fiderCmd = lib.getExe cfg.package;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.fider = {
|
||||||
|
enable = lib.mkEnableOption "the Fider server";
|
||||||
|
package = lib.mkPackageOption pkgs "fider" { };
|
||||||
|
|
||||||
|
dataDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/lib/fider";
|
||||||
|
description = "Default data folder for Fider.";
|
||||||
|
example = "/mnt/fider";
|
||||||
|
};
|
||||||
|
|
||||||
|
database = {
|
||||||
|
url = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "local";
|
||||||
|
description = ''
|
||||||
|
URI to use for the main PostgreSQL database. If this needs to include
|
||||||
|
credentials that shouldn't be world-readable in the Nix store, set an
|
||||||
|
environment file on the systemd service and override the
|
||||||
|
`DATABASE_URL` entry. Pass the string
|
||||||
|
`local` to setup a database on the local server.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf lib.types.str;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
PORT = "31213";
|
||||||
|
BASE_URL = "https://fider.example.com";
|
||||||
|
EMAIL = "smtp";
|
||||||
|
EMAIL_NOREPLY = "fider@example.com";
|
||||||
|
EMAIL_SMTP_USERNAME = "fider@example.com";
|
||||||
|
EMAIL_SMTP_HOST = "mail.example.com";
|
||||||
|
EMAIL_SMTP_PORT = "587";
|
||||||
|
BLOB_STORAGE = "fs";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Environment variables to set for the service. Secrets should be
|
||||||
|
specified using {option}`environmentFiles`.
|
||||||
|
Refer to <https://github.com/getfider/fider/blob/stable/.example.env>
|
||||||
|
and <https://github.com/getfider/fider/blob/stable/app/pkg/env/env.go>
|
||||||
|
for available options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
environmentFiles = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.path;
|
||||||
|
default = [ ];
|
||||||
|
example = "/run/secrets/fider.env";
|
||||||
|
description = ''
|
||||||
|
Files to load environment variables from. Loaded variables override
|
||||||
|
values set in {option}`environment`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.postgresql = lib.mkIf (cfg.database.url == "local") {
|
||||||
|
enable = true;
|
||||||
|
ensureUsers = [
|
||||||
|
{
|
||||||
|
name = "fider";
|
||||||
|
ensureDBOwnership = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
ensureDatabases = [ "fider" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.fider = {
|
||||||
|
description = "Fider server";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [
|
||||||
|
"network.target"
|
||||||
|
] ++ lib.optionals (cfg.database.url == "local") [ "postgresql.service" ];
|
||||||
|
requires = lib.optionals (cfg.database.url == "local") [ "postgresql.service" ];
|
||||||
|
environment =
|
||||||
|
let
|
||||||
|
localPostgresqlUrl = "postgres:///fider?host=/run/postgresql";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
DATABASE_URL = if (cfg.database.url == "local") then localPostgresqlUrl else cfg.database.url;
|
||||||
|
BLOB_STORAGE_FS_PATH = "${cfg.dataDir}";
|
||||||
|
}
|
||||||
|
// cfg.environment;
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStartPre = "${fiderCmd} migrate";
|
||||||
|
ExecStart = fiderCmd;
|
||||||
|
StateDirectory = "fider";
|
||||||
|
DynamicUser = true;
|
||||||
|
PrivateTmp = "yes";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RuntimeDirectory = "fider";
|
||||||
|
RuntimeDirectoryPreserve = true;
|
||||||
|
CacheDirectory = "fider";
|
||||||
|
WorkingDirectory = "${cfg.package}";
|
||||||
|
EnvironmentFile = cfg.environmentFiles;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
maintainers = with lib.maintainers; [
|
||||||
|
drupol
|
||||||
|
niklaskorz
|
||||||
|
];
|
||||||
|
# doc = ./fider.md;
|
||||||
|
};
|
||||||
|
}
|
|
@ -336,6 +336,7 @@ in {
|
||||||
fenics = handleTest ./fenics.nix {};
|
fenics = handleTest ./fenics.nix {};
|
||||||
ferm = handleTest ./ferm.nix {};
|
ferm = handleTest ./ferm.nix {};
|
||||||
ferretdb = handleTest ./ferretdb.nix {};
|
ferretdb = handleTest ./ferretdb.nix {};
|
||||||
|
fider = runTest ./fider.nix;
|
||||||
filesender = handleTest ./filesender.nix {};
|
filesender = handleTest ./filesender.nix {};
|
||||||
filesystems-overlayfs = runTest ./filesystems-overlayfs.nix;
|
filesystems-overlayfs = runTest ./filesystems-overlayfs.nix;
|
||||||
firefly-iii = handleTest ./firefly-iii.nix {};
|
firefly-iii = handleTest ./firefly-iii.nix {};
|
||||||
|
|
33
nixos/tests/fider.nix
Normal file
33
nixos/tests/fider.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
name = "fider-server";
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.fider = {
|
||||||
|
enable = true;
|
||||||
|
environment = {
|
||||||
|
JWT_SECRET = "not_so_secret";
|
||||||
|
BASE_URL = "/";
|
||||||
|
EMAIL_NOREPLY = "noreply@fider.io";
|
||||||
|
EMAIL_SMTP_HOST = "mailhog";
|
||||||
|
EMAIL_SMTP_PORT = "1025";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = ''
|
||||||
|
machine.start()
|
||||||
|
machine.wait_for_unit("fider.service")
|
||||||
|
machine.wait_for_open_port(3000)
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [
|
||||||
|
drupol
|
||||||
|
niklaskorz
|
||||||
|
];
|
||||||
|
}
|
|
@ -5,6 +5,8 @@
|
||||||
callPackage,
|
callPackage,
|
||||||
esbuild,
|
esbuild,
|
||||||
buildGoModule,
|
buildGoModule,
|
||||||
|
nixosTests,
|
||||||
|
nix-update-script,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
|
@ -87,6 +89,13 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
tests = {
|
||||||
|
inherit (nixosTests) fider;
|
||||||
|
};
|
||||||
|
updateScript = nix-update-script { };
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Open platform to collect and prioritize feedback";
|
description = "Open platform to collect and prioritize feedback";
|
||||||
homepage = "https://github.com/getfider/fider";
|
homepage = "https://github.com/getfider/fider";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue