migrated channel 24.05 to unstable

This commit is contained in:
2024-10-27 17:10:31 -06:00
parent 6b6b7e39b1
commit 37aa35daed
22 changed files with 131 additions and 557 deletions

View File

@@ -1,82 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.mealie;
pkg = cfg.package;
in
{
options.services.mealie = {
enable = lib.mkEnableOption "Mealie, a recipe manager and meal planner";
package = lib.mkPackageOption pkgs "mealie" { };
listenAddress = lib.mkOption {
type = lib.types.str;
default = "0.0.0.0";
description = "Address on which the service should listen.";
};
port = lib.mkOption {
type = lib.types.port;
default = 9000;
description = "Port on which to serve the Mealie service.";
};
settings = lib.mkOption {
type = with lib.types; attrsOf anything;
default = { };
description = ''
Configuration of the Mealie service.
See [the mealie documentation](https://nightly.mealie.io/documentation/getting-started/installation/backend-config/) for available options and default values.
'';
example = {
ALLOW_SIGNUP = "false";
};
};
credentialsFile = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
example = "/run/secrets/mealie-credentials.env";
description = ''
File containing credentials used in mealie such as {env}`POSTGRES_PASSWORD`
or sensitive LDAP options.
Expects the format of an `EnvironmentFile=`, as described by {manpage}`systemd.exec(5)`.
'';
};
};
config = lib.mkIf cfg.enable {
systemd.services.mealie = {
description = "Mealie, a self hosted recipe manager and meal planner";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
PRODUCTION = "true";
API_PORT = toString cfg.port;
BASE_URL = "http://localhost:${toString cfg.port}";
DATA_DIR = "/var/lib/mealie";
CRF_MODEL_PATH = "/var/lib/mealie/model.crfmodel";
} // (builtins.mapAttrs (_: toString) cfg.settings);
serviceConfig = {
DynamicUser = true;
User = "mealie";
ExecStartPre = "${pkg}/libexec/init_db";
ExecStart = "${lib.getExe pkg} -b ${cfg.listenAddress}:${builtins.toString cfg.port}";
EnvironmentFile = lib.mkIf (cfg.credentialsFile != null) cfg.credentialsFile;
StateDirectory = "mealie";
StandardOutput = "journal";
};
};
};
}

View File

@@ -1,61 +0,0 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.programs.obs-studio;
in
{
options.programs.obs-studio = {
enable = lib.mkEnableOption (lib.mdDoc "obs-studio");
package = lib.mkPackageOption pkgs "obs-studio" { example = "obs-studio"; };
finalPackage = lib.mkOption {
type = lib.types.package;
visible = false;
readOnly = true;
description = "Resulting customized OBS Studio package.";
};
plugins = lib.mkOption {
default = [ ];
example = lib.literalExpression "[ pkgs.obs-studio-plugins.wlrobs ]";
description = "Optional OBS plugins.";
type = lib.types.listOf lib.types.package;
};
enableVirtualCamera = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Installs and sets up the v4l2loopback kernel module, necessary for OBS
to start a virtual camera.
'';
};
};
config = lib.mkIf cfg.enable {
programs.obs-studio.finalPackage = pkgs.wrapOBS.override { obs-studio = cfg.package; } {
inherit (cfg) plugins;
};
environment.systemPackages = [ cfg.finalPackage ];
boot = lib.mkIf cfg.enableVirtualCamera {
kernelModules = [ "v4l2loopback" ];
extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ];
extraModprobeConfig = ''
options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
'';
};
security.polkit.enable = lib.mkIf cfg.enableVirtualCamera true;
};
meta.maintainers = with lib.maintainers; [ CaptainJawZ ];
}

View File

@@ -1,146 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.shiori;
in
{
options = {
services.shiori = {
enable = lib.mkEnableOption "Shiori simple bookmarks manager";
package = lib.mkPackageOption pkgs "shiori" { };
address = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
The IP address on which Shiori will listen.
If empty, listens on all interfaces.
'';
};
port = lib.mkOption {
type = lib.types.port;
default = 8080;
description = "The port of the Shiori web application";
};
webRoot = lib.mkOption {
type = lib.types.str;
default = "/";
example = "/shiori";
description = "The root of the Shiori web application";
};
environmentFile = lib.mkOption {
type = lib.types.null or lib.types.path;
default = null;
example = "/path/to/environmentFile";
description = ''
Path to file containing environment variables.
Useful for passing down secrets.
<https://github.com/go-shiori/shiori/blob/master/docs/Configuration.md#overall-configuration>
'';
};
databaseUrl = lib.mkOption {
type = lib.types.null or lib.types.str;
default = null;
example = "postgresql:///shiori?host=/run/postgresql";
description = "The connection URL to connect to MySQL or PostgreSQL";
};
};
};
config = lib.mkIf cfg.enable {
systemd.services.shiori = {
description = "Shiori simple bookmarks manager";
wantedBy = [ "multi-user.target" ];
after = [
"postgresql.service"
"mysql.service"
];
environment = {
SHIORI_DIR = "/var/lib/shiori";
} // lib.optionalAttrs (cfg.databaseUrl != null) { SHIORI_DATABASE_URL = cfg.databaseUrl; };
serviceConfig = {
ExecStart = "${cfg.package}/bin/shiori server --address '${cfg.address}' --port '${toString cfg.port}' --webroot '${cfg.webRoot}'";
DynamicUser = true;
StateDirectory = "shiori";
# As the RootDirectory
RuntimeDirectory = "shiori";
# Security options
EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
BindReadOnlyPaths =
[
"/nix/store"
# For SSL certificates, and the resolv.conf
"/etc"
]
++ lib.optional (
lib.strings.hasInfix "postgres" cfg.databaseUrl && config.services.postgresql.enable
) "/run/postgresql"
++ lib.optional (
lib.strings.hasInfix "mysql" cfg.databaseUrl && config.services.mysql.enable
) "/var/run/mysqld";
CapabilityBoundingSet = "";
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
DeviceAllow = "";
LockPersonality = true;
MemoryDenyWriteExecute = true;
PrivateDevices = true;
PrivateUsers = true;
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
RestrictNamespaces = true;
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_UNIX"
];
RestrictRealtime = true;
RestrictSUIDSGID = true;
RootDirectory = "/run/shiori";
SystemCallArchitectures = "native";
SystemCallErrorNumber = "EPERM";
SystemCallFilter = [
"@system-service"
"~@cpu-emulation"
"~@debug"
"~@keyring"
"~@memlock"
"~@obsolete"
"~@privileged"
"~@setuid"
];
};
};
};
meta.maintainers = with lib.maintainers; [
minijackson
CaptainJawZ
];
}

View File

@@ -1,47 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.stash;
in
{
options = {
services.stash = {
enable = lib.mkEnableOption "Stash";
package = lib.mkPackageOption pkgs "stash" { };
# port = lib.mkOption {
# type = lib.types.port;
# default = 8080;
# description = "The port of the Stash web application";
# };
};
};
config = lib.mkIf cfg.enable {
systemd.services.stash = {
description = "Stash";
wantedBy = [ "multi-user.target" ];
# environment = {
# STASH_DIR = "/var/lib/stash";
# } // lib.optionalAttrs (cfg.databaseUrl != null) {
# STASH_DATABASE_URL = cfg.databaseUrl;
# };
serviceConfig = {
ExecStart = "${cfg.package}/bin/stash server --address '${cfg.address}' --port '${toString cfg.port}' --webroot '${cfg.webRoot}'";
EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
RootDirectory = "/var/lib/stash";
};
};
};
meta.maintainers = with lib.maintainers; [ CaptainJawZ ];
}