1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 17:46:29 +09:00

yarr: 2.4 -> 2.5, nixos/yarr: init (#393922)

This commit is contained in:
misuzu 2025-04-23 14:26:53 +03:00 committed by GitHub
commit 13c54bde10
Signed by: github
GPG key ID: B5690EEEBB952194
6 changed files with 158 additions and 14 deletions

View file

@ -160,6 +160,8 @@
- [GlitchTip](https://glitchtip.com/), an open source Sentry API compatible error tracking platform. Available as [services.glitchtip](#opt-services.glitchtip.enable).
- [`yarr`](https://github.com/nkanaev/yarr), a small, web-based feed aggregator and RSS reader. Available as [services.yarr](#opt-services.yarr.enable).
- [Stash](https://github.com/stashapp/stash), An organizer for your adult videos/images, written in Go. Available as [services.stash](#opt-services.stash.enable).
- [vsmartcard-vpcd](https://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html), a virtual smart card driver. Available as [services.vsmartcard-vpcd](#opt-services.vsmartcard-vpcd.enable).

View file

@ -929,6 +929,7 @@
./services/misc/weechat.nix
./services/misc/workout-tracker.nix
./services/misc/xmrig.nix
./services/misc/yarr.nix
./services/misc/ytdl-sub.nix
./services/misc/zoneminder.nix
./services/misc/zookeeper.nix

View file

@ -0,0 +1,118 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
types
mkIf
mkOption
mkEnableOption
mkPackageOption
optionalString
;
cfg = config.services.yarr;
in
{
meta.maintainers = with lib.maintainers; [ christoph-heiss ];
options.services.yarr = {
enable = mkEnableOption "Yet another rss reader";
package = mkPackageOption pkgs "yarr" { };
environmentFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
Environment file for specifying additional settings such as secrets.
See `yarr -help` for all available options.
'';
};
address = mkOption {
type = types.str;
default = "localhost";
description = "Address to run server on.";
};
port = mkOption {
type = types.port;
default = 7070;
description = "Port to run server on.";
};
baseUrl = mkOption {
type = types.nullOr types.str;
default = null;
description = "Base path of the service url.";
};
authFilePath = mkOption {
type = types.nullOr types.path;
default = null;
description = "Path to a file containing username:password. `null` means no authentication required to use the service.";
};
};
config = mkIf cfg.enable {
systemd.services.yarr = {
description = "Yet another rss reader";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
environment.XDG_CONFIG_HOME = "/var/lib/yarr/.config";
serviceConfig = {
Type = "simple";
Restart = "on-failure";
StateDirectory = "yarr";
StateDirectoryMode = "0700";
WorkingDirectory = "/var/lib/yarr";
EnvironmentFile = cfg.environmentFile;
LoadCredential = mkIf (cfg.authFilePath != null) "authfile:${cfg.authFilePath}";
DynamicUser = true;
DevicePolicy = "closed";
LockPersonality = "yes";
MemoryDenyWriteExecute = true;
NoNewPrivileges = true;
PrivateDevices = true;
PrivateMounts = true;
PrivateTmp = true;
ProcSubset = "pid";
ProtectClock = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectHostname = true;
ProtectKernelLogs = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectProc = "invisible";
ProtectSystem = "strict";
RemoveIPC = true;
RestrictAddressFamilies = "AF_INET AF_INET6";
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;
UMask = "0077";
ExecStart = ''
${lib.getExe cfg.package} \
-db storage.db \
-addr "${cfg.address}:${toString cfg.port}" \
${optionalString (cfg.baseUrl != null) "-base ${cfg.baseUrl}"} \
${optionalString (cfg.authFilePath != null) "-auth-file /run/credentials/yarr.service/authfile"}
'';
};
};
};
}

View file

@ -1478,6 +1478,7 @@ in
xterm = runTest ./xterm.nix;
xxh = runTest ./xxh.nix;
yabar = runTest ./yabar.nix;
yarr = runTest ./yarr.nix;
ydotool = handleTest ./ydotool.nix { };
yggdrasil = runTest ./yggdrasil.nix;
your_spotify = runTest ./your_spotify.nix;

19
nixos/tests/yarr.nix Normal file
View file

@ -0,0 +1,19 @@
{ lib, pkgs, ... }:
{
name = "yarr";
meta.maintainers = with lib.maintainers; [ christoph-heiss ];
nodes.machine =
{ pkgs, ... }:
{
services.yarr.enable = true;
};
testScript = ''
machine.start()
machine.wait_for_unit("yarr.service")
machine.wait_for_open_port(7070)
machine.succeed("curl -sSf http://localhost:7070 | grep '<title>yarr!</title>'")
'';
}

View file

@ -1,26 +1,26 @@
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
testers,
yarr,
versionCheckHook,
nix-update-script,
nixosTests,
}:
buildGoModule rec {
pname = "yarr";
version = "2.4";
version = "2.5";
src = fetchFromGitHub {
owner = "nkanaev";
repo = "yarr";
rev = "v${version}";
hash = "sha256-ZMQ+IX8dZuxyxQhD/eWAe4bGGCVcaCeVgF+Wqs79G+k=";
hash = "sha256-yII0KV4AKIS1Tfhvj588O631JDArnr0/30rNynTSwzk=";
};
vendorHash = null;
subPackages = [ "src" ];
ldflags = [
"-s"
"-w"
@ -30,16 +30,16 @@ buildGoModule rec {
tags = [
"sqlite_foreign_keys"
"release"
"sqlite_json"
];
postInstall = ''
mv $out/bin/{src,yarr}
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru.tests.version = testers.testVersion {
package = yarr;
version = "v${version}";
passthru = {
updateScript = nix-update-script { };
tests = lib.optionalAttrs stdenv.hostPlatform.isLinux nixosTests.yarr;
};
meta = with lib; {
@ -48,6 +48,9 @@ buildGoModule rec {
homepage = "https://github.com/nkanaev/yarr";
changelog = "https://github.com/nkanaev/yarr/blob/v${version}/doc/changelog.txt";
license = licenses.mit;
maintainers = with maintainers; [ sikmir ];
maintainers = with maintainers; [
sikmir
christoph-heiss
];
};
}