mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
Merge staging-next into staging
This commit is contained in:
commit
c5b82a046f
85 changed files with 2966 additions and 1372 deletions
|
@ -56,6 +56,8 @@
|
|||
|
||||
- `services.lemmy.settings.federation` was removed in 0.17.0 and no longer has any effect. To enable federation, the hostname must be set in the configuration file and then federation must be enabled in the admin web UI. See the [release notes](https://github.com/LemmyNet/lemmy/blob/c32585b03429f0f76d1e4ff738786321a0a9df98/RELEASES.md#upgrade-instructions) for more details.
|
||||
|
||||
- The following packages in `haskellPackages` have now a separate bin output: `cabal-fmt`, `calligraphy`, `eventlog2html`, `ghc-debug-brick`, `hindent`, `nixfmt`, `releaser`. This means you need to replace e.g. `"${pkgs.haskellPackages.nixfmt}/bin/nixfmt"` with `"${lib.getBin pkgs.haskellPackages.nixfmt}/bin/nixfmt"` or `"${lib.getExe pkgs.haskellPackages.nixfmt}"`. The binaries also won’t be in scope if you rely on them being installed e.g. via `ghcWithPackages`. `environment.packages` picks the `bin` output automatically, so for normal installation no intervention is required. Also, toplevel attributes like `pkgs.nixfmt` are not impacted negatively by this change.
|
||||
|
||||
- `spamassassin` no longer supports the `Hashcash` module. The module needs to be removed from the `loadplugin` list if it was copied over from the default `initPreConf` option.
|
||||
|
||||
## Other Notable Changes {#sec-release-23.11-notable-changes}
|
||||
|
@ -78,6 +80,8 @@
|
|||
|
||||
- `services.prometheus.exporters` has a new exporter to monitor electrical power consumption based on PowercapRAPL sensor called [Scaphandre](https://github.com/hubblo-org/scaphandre), see [#239803](https://github.com/NixOS/nixpkgs/pull/239803) for more details.
|
||||
|
||||
- The module `services.calibre-server` has new options to configure the `host`, `port`, `auth.enable`, `auth.mode` and `auth.userDb` path, see [#216497](https://github.com/NixOS/nixpkgs/pull/216497/) for more details.
|
||||
|
||||
## Nixpkgs internals {#sec-release-23.11-nixpkgs-internals}
|
||||
|
||||
- The `qemu-vm.nix` module by default now identifies block devices via
|
||||
|
|
|
@ -8,7 +8,7 @@ let
|
|||
|
||||
x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } ''
|
||||
mkdir -p "$out/share/X11/fonts"
|
||||
font_regexp='.*\.\(ttf\|ttc\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
|
||||
font_regexp='.*\.\(ttf\|ttc\|otb\|otf\|pcf\|pfa\|pfb\|bdf\)\(\.gz\)?'
|
||||
find ${toString config.fonts.fonts} -regex "$font_regexp" \
|
||||
-exec ln -sf -t "$out/share/X11/fonts" '{}' \;
|
||||
cd "$out/share/X11/fonts"
|
||||
|
|
|
@ -6,6 +6,17 @@ let
|
|||
|
||||
cfg = config.services.calibre-server;
|
||||
|
||||
documentationLink = "https://manual.calibre-ebook.com";
|
||||
generatedDocumentationLink = documentationLink + "/generated/en/calibre-server.html";
|
||||
|
||||
execFlags = (concatStringsSep " "
|
||||
(mapAttrsToList (k: v: "${k} ${toString v}") (filterAttrs (name: value: value != null) {
|
||||
"--listen-on" = cfg.host;
|
||||
"--port" = cfg.port;
|
||||
"--auth-mode" = cfg.auth.mode;
|
||||
"--userdb" = cfg.auth.userDb;
|
||||
}) ++ [(optionalString (cfg.auth.enable == true) "--enable-auth")])
|
||||
);
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -18,52 +29,100 @@ in
|
|||
)
|
||||
];
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
services.calibre-server = {
|
||||
|
||||
enable = mkEnableOption (lib.mdDoc "calibre-server");
|
||||
package = lib.mkPackageOptionMD pkgs "calibre" { };
|
||||
|
||||
libraries = mkOption {
|
||||
description = lib.mdDoc ''
|
||||
The directories of the libraries to serve. They must be readable for the user under which the server runs.
|
||||
'';
|
||||
type = types.listOf types.path;
|
||||
default = [ "/var/lib/calibre-server" ];
|
||||
description = lib.mdDoc ''
|
||||
Make sure each library path is initialized before service startup.
|
||||
The directories of the libraries to serve. They must be readable for the user under which the server runs.
|
||||
See the [calibredb documentation](${documentationLink}/generated/en/calibredb.html#add) for details.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
description = lib.mdDoc "The user under which calibre-server runs.";
|
||||
type = types.str;
|
||||
default = "calibre-server";
|
||||
description = lib.mdDoc "The user under which calibre-server runs.";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
description = lib.mdDoc "The group under which calibre-server runs.";
|
||||
type = types.str;
|
||||
default = "calibre-server";
|
||||
description = lib.mdDoc "The group under which calibre-server runs.";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "0.0.0.0";
|
||||
example = "::1";
|
||||
description = lib.mdDoc ''
|
||||
The interface on which to listen for connections.
|
||||
See the [calibre-server documentation](${generatedDocumentationLink}#cmdoption-calibre-server-listen-on) for details.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
default = 8080;
|
||||
type = types.port;
|
||||
description = lib.mdDoc ''
|
||||
The port on which to listen for connections.
|
||||
See the [calibre-server documentation](${generatedDocumentationLink}#cmdoption-calibre-server-port) for details.
|
||||
'';
|
||||
};
|
||||
|
||||
auth = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = lib.mdDoc ''
|
||||
Password based authentication to access the server.
|
||||
See the [calibre-server documentation](${generatedDocumentationLink}#cmdoption-calibre-server-enable-auth) for details.
|
||||
'';
|
||||
};
|
||||
|
||||
mode = mkOption {
|
||||
type = types.enum [ "auto" "basic" "digest" ];
|
||||
default = "auto";
|
||||
description = lib.mdDoc ''
|
||||
Choose the type of authentication used.
|
||||
Set the HTTP authentication mode used by the server.
|
||||
See the [calibre-server documentation](${generatedDocumentationLink}#cmdoption-calibre-server-auth-mode) for details.
|
||||
'';
|
||||
};
|
||||
|
||||
userDb = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.path;
|
||||
description = lib.mdDoc ''
|
||||
Choose users database file to use for authentication.
|
||||
Make sure users database file is initialized before service startup.
|
||||
See the [calibre-server documentation](${documentationLink}/server.html#managing-user-accounts-from-the-command-line-only) for details.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.services.calibre-server = {
|
||||
description = "Calibre Server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.calibre}/bin/calibre-server ${lib.concatStringsSep " " cfg.libraries}";
|
||||
};
|
||||
|
||||
description = "Calibre Server";
|
||||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Restart = "always";
|
||||
ExecStart = "${cfg.package}/bin/calibre-server ${lib.concatStringsSep " " cfg.libraries} ${execFlags}";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.calibre ];
|
||||
|
||||
users.users = optionalAttrs (cfg.user == "calibre-server") {
|
||||
|
@ -83,4 +142,5 @@ in
|
|||
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ gaelreyrol ];
|
||||
}
|
||||
|
|
|
@ -86,8 +86,7 @@ let
|
|||
SupplementaryGroups = optional enableRedis redisServer.user;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [ "@system-service" "~@privileged @setuid @keyring" ];
|
||||
# Does not work well with the temporary root
|
||||
#UMask = "0066";
|
||||
UMask = "0066";
|
||||
};
|
||||
in
|
||||
{
|
||||
|
|
|
@ -1126,7 +1126,7 @@ in
|
|||
It will notify, via the UI, when a new version is available.
|
||||
The check itself will not prompt any auto-updates of the Grafana software, nor will it send any sensitive information.
|
||||
'';
|
||||
default = true;
|
||||
default = false;
|
||||
type = types.bool;
|
||||
};
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ in {
|
|||
cage = handleTest ./cage.nix {};
|
||||
cagebreak = handleTest ./cagebreak.nix {};
|
||||
calibre-web = handleTest ./calibre-web.nix {};
|
||||
calibre-server = handleTest ./calibre-server.nix {};
|
||||
cassandra_3_0 = handleTest ./cassandra.nix { testPackage = pkgs.cassandra_3_0; };
|
||||
cassandra_3_11 = handleTest ./cassandra.nix { testPackage = pkgs.cassandra_3_11; };
|
||||
cassandra_4 = handleTest ./cassandra.nix { testPackage = pkgs.cassandra_4; };
|
||||
|
|
104
nixos/tests/calibre-server.nix
Normal file
104
nixos/tests/calibre-server.nix
Normal file
|
@ -0,0 +1,104 @@
|
|||
{ system ? builtins.currentSystem
|
||||
, config ? { }
|
||||
, pkgs ? import ../.. { inherit system config; }
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
|
||||
inherit (pkgs.lib) concatStringsSep maintainers mapAttrs mkMerge
|
||||
removeSuffix splitString;
|
||||
|
||||
tests = {
|
||||
default = {
|
||||
calibreConfig = {};
|
||||
calibreScript = ''
|
||||
wait_for_unit("calibre-server.service")
|
||||
'';
|
||||
};
|
||||
customLibrary = {
|
||||
calibreConfig = {
|
||||
libraries = [ "/var/lib/calibre-data" ];
|
||||
};
|
||||
calibreScript = ''
|
||||
succeed("ls -la /var/lib/calibre-data")
|
||||
wait_for_unit("calibre-server.service")
|
||||
'';
|
||||
};
|
||||
multipleLibraries = {
|
||||
calibreConfig = {
|
||||
libraries = [ "/var/lib/calibre-data" "/var/lib/calibre-server" ];
|
||||
};
|
||||
calibreScript = ''
|
||||
succeed("ls -la /var/lib/calibre-data")
|
||||
succeed("ls -la /var/lib/calibre-server")
|
||||
wait_for_unit("calibre-server.service")
|
||||
'';
|
||||
};
|
||||
hostAndPort = {
|
||||
calibreConfig = {
|
||||
host = "127.0.0.1";
|
||||
port = 8888;
|
||||
};
|
||||
calibreScript = ''
|
||||
wait_for_unit("calibre-server.service")
|
||||
wait_for_open_port(8888)
|
||||
succeed("curl --fail http://127.0.0.1:8888")
|
||||
'';
|
||||
};
|
||||
basicAuth = {
|
||||
calibreConfig = {
|
||||
host = "127.0.0.1";
|
||||
port = 8888;
|
||||
auth = {
|
||||
enable = true;
|
||||
mode = "basic";
|
||||
};
|
||||
};
|
||||
calibreScript = ''
|
||||
wait_for_unit("calibre-server.service")
|
||||
wait_for_open_port(8888)
|
||||
fail("curl --fail http://127.0.0.1:8888")
|
||||
'';
|
||||
};
|
||||
};
|
||||
in
|
||||
mapAttrs
|
||||
(test: testConfig: (makeTest (
|
||||
let
|
||||
nodeName = testConfig.nodeName or test;
|
||||
calibreConfig = {
|
||||
enable = true;
|
||||
libraries = [ "/var/lib/calibre-server" ];
|
||||
} // testConfig.calibreConfig or {};
|
||||
librariesInitScript = path: ''
|
||||
${nodeName}.execute("touch /tmp/test.epub")
|
||||
${nodeName}.execute("zip -r /tmp/test.zip /tmp/test.epub")
|
||||
${nodeName}.execute("mkdir -p ${path}")
|
||||
${nodeName}.execute("calibredb add -d --with-library ${path} /tmp/test.zip")
|
||||
'';
|
||||
in
|
||||
{
|
||||
name = "calibre-server-${test}";
|
||||
|
||||
nodes.${nodeName} = mkMerge [{
|
||||
environment.systemPackages = [ pkgs.zip ];
|
||||
services.calibre-server = calibreConfig;
|
||||
} testConfig.calibreProvider or { }];
|
||||
|
||||
testScript = ''
|
||||
${nodeName}.start()
|
||||
${concatStringsSep "\n" (map librariesInitScript calibreConfig.libraries)}
|
||||
${concatStringsSep "\n" (map (line:
|
||||
if (builtins.substring 0 1 line == " " || builtins.substring 0 1 line == ")")
|
||||
then line
|
||||
else "${nodeName}.${line}"
|
||||
) (splitString "\n" (removeSuffix "\n" testConfig.calibreScript)))}
|
||||
${nodeName}.shutdown()
|
||||
'';
|
||||
|
||||
meta = with maintainers; {
|
||||
maintainers = [ gaelreyrol ];
|
||||
};
|
||||
}
|
||||
)))
|
||||
tests
|
Loading…
Add table
Add a link
Reference in a new issue