mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 12:45:27 +03:00
pkgs/readeck + nixos/readeck: init (#370354)
This commit is contained in:
commit
f2685b1e2f
6 changed files with 216 additions and 0 deletions
|
@ -79,6 +79,8 @@
|
|||
|
||||
- [Conduwuit](https://conduwuit.puppyirl.gay/), a federated chat server implementing the Matrix protocol, forked from Conduit. Available as [services.conduwuit](#opt-services.conduwuit.enable).
|
||||
|
||||
- [Readeck](https://readeck.org/), a read-it later web-application. Available as [services.readeck](#opt-services.readeck.enable).
|
||||
|
||||
- [Traccar](https://www.traccar.org/), a modern GPS Tracking Platform. Available as [services.traccar](#opt-services.traccar.enable).
|
||||
|
||||
- [Schroot](https://codeberg.org/shelter/reschroot), a lightweight virtualisation tool. Securely enter a chroot and run a command or login shell. Available as [programs.schroot](#opt-programs.schroot.enable).
|
||||
|
|
|
@ -1567,6 +1567,7 @@
|
|||
./services/web-apps/screego.nix
|
||||
./services/web-apps/sftpgo.nix
|
||||
./services/web-apps/suwayomi-server.nix
|
||||
./services/web-apps/readeck.nix
|
||||
./services/web-apps/rss-bridge.nix
|
||||
./services/web-apps/selfoss.nix
|
||||
./services/web-apps/shiori.nix
|
||||
|
|
96
nixos/modules/services/web-apps/readeck.nix
Normal file
96
nixos/modules/services/web-apps/readeck.nix
Normal file
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkPackageOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
cfg = config.services.readeck;
|
||||
settingsFormat = pkgs.formats.toml { };
|
||||
configFile = settingsFormat.generate "readeck.toml" cfg.settings;
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
meta.maintainers = [ lib.maintainers.julienmalka ];
|
||||
|
||||
options = {
|
||||
services.readeck = {
|
||||
enable = mkEnableOption "Readeck";
|
||||
|
||||
package = mkPackageOption pkgs "readeck" { };
|
||||
|
||||
environmentFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
description = ''
|
||||
File containing environment variables to be passed to Readeck.
|
||||
May be used to provide the Readeck secret key by setting the READECK_SECRET_KEY variable.
|
||||
'';
|
||||
default = null;
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = { };
|
||||
example = {
|
||||
main.log_level = "debug";
|
||||
server.port = 9000;
|
||||
};
|
||||
description = ''
|
||||
Additional configuration for Readeck, see
|
||||
<https://readeck.org/en/docs/configuration>
|
||||
for supported values.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.readeck = {
|
||||
description = "Readeck";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
StateDirectory = "readeck";
|
||||
WorkingDirectory = "/var/lib/readeck";
|
||||
EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
|
||||
DynamicUser = true;
|
||||
ExecStart = "${lib.getExe cfg.package} serve -config ${configFile}";
|
||||
ProtectSystem = "full";
|
||||
SystemCallArchitectures = "native";
|
||||
MemoryDenyWriteExecute = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_UNIX"
|
||||
"AF_NETLINK"
|
||||
];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
DevicePolicy = "closed";
|
||||
ProtectClock = true;
|
||||
ProtectHostname = true;
|
||||
ProtectProc = "invisible";
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
LockPersonality = true;
|
||||
Restart = "on-failure";
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -894,6 +894,7 @@ in {
|
|||
rathole = handleTest ./rathole.nix {};
|
||||
readarr = handleTest ./readarr.nix {};
|
||||
realm = handleTest ./realm.nix {};
|
||||
readeck = runTest ./readeck.nix;
|
||||
redis = handleTest ./redis.nix {};
|
||||
redlib = handleTest ./redlib.nix {};
|
||||
redmine = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./redmine.nix {};
|
||||
|
|
24
nixos/tests/readeck.nix
Normal file
24
nixos/tests/readeck.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
name = "readeck";
|
||||
meta.maintainers = with lib.maintainers; [ julienmalka ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
services.readeck = {
|
||||
enable = true;
|
||||
environmentFile = pkgs.writeText "env-file" ''
|
||||
READECK_SECRET_KEY="verysecretkey"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.start()
|
||||
machine.wait_for_unit("readeck.service")
|
||||
machine.wait_for_open_port(8000)
|
||||
machine.succeed("curl --fail http://localhost:8000/login?r=%2F")
|
||||
'';
|
||||
}
|
92
pkgs/by-name/re/readeck/package.nix
Normal file
92
pkgs/by-name/re/readeck/package.nix
Normal file
|
@ -0,0 +1,92 @@
|
|||
{
|
||||
fetchFromGitea,
|
||||
fetchNpmDeps,
|
||||
buildGoModule,
|
||||
nodejs,
|
||||
npmHooks,
|
||||
lib,
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
file-compose = buildGoModule {
|
||||
pname = "file-compose";
|
||||
version = "unstable-2023-10-21";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "codeberg.org";
|
||||
owner = "readeck";
|
||||
repo = "file-compose";
|
||||
rev = "afa938655d412556a0db74b202f9bcc1c40d8579";
|
||||
hash = "sha256-rMANRqUQRQ8ahlxuH1sWjlGpNvbReBOXIkmBim/wU2o=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-Qwixx3Evbf+53OFeS3Zr7QCkRMfgqc9hUA4eqEBaY0c=";
|
||||
};
|
||||
in
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "readeck";
|
||||
version = "0.17.1";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "codeberg.org";
|
||||
owner = "readeck";
|
||||
repo = "readeck";
|
||||
tag = version;
|
||||
hash = "sha256-+GgjR1mxD93bFNaLeDuEefPlQEV9jNgFIo8jTAxphyo=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
npmHooks.npmConfigHook
|
||||
];
|
||||
|
||||
npmRoot = "web";
|
||||
|
||||
NODE_PATH = "$npmDeps";
|
||||
|
||||
preBuild = ''
|
||||
make web-build
|
||||
${file-compose}/bin/file-compose -format json docs/api/api.yaml docs/assets/api.json
|
||||
go run ./tools/docs docs/src docs/assets
|
||||
'';
|
||||
|
||||
tags = [
|
||||
"netgo"
|
||||
"osusergo"
|
||||
"sqlite_omit_load_extension"
|
||||
"sqlite_foreign_keys"
|
||||
"sqlite_json1"
|
||||
"sqlite_fts5"
|
||||
"sqlite_secure_delete"
|
||||
];
|
||||
|
||||
ldflags = [
|
||||
"-X"
|
||||
"codeberg.org/readeck/readeck/configs.version=${version}"
|
||||
];
|
||||
overrideModAttrs = oldAttrs: {
|
||||
# Do not add `npmConfigHook` to `goModules`
|
||||
nativeBuildInputs = lib.remove npmHooks.npmConfigHook oldAttrs.nativeBuildInputs;
|
||||
# Do not run `preBuild` when building `goModules`
|
||||
preBuild = null;
|
||||
};
|
||||
|
||||
npmDeps = fetchNpmDeps {
|
||||
src = "${src}/web";
|
||||
hash = "sha256-7fRSkXKAMEC7rFmSF50DM66SVhV68g93PMBjrtkd9/E=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-O/ZrpT6wTtPwBDUCAmR0XHRgQmd46/MPvWNE0EvD3bg=";
|
||||
|
||||
meta = {
|
||||
description = "Web application that lets you save the readable content of web pages you want to keep forever.";
|
||||
mainProgram = "readeck";
|
||||
homepage = "https://readeck.org/";
|
||||
changelog = "https://github.com/readeck/readeck/releases/tag/${version}";
|
||||
license = lib.licenses.agpl3Only;
|
||||
maintainers = with lib.maintainers; [ julienmalka ];
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue