Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide/nixos: remove with lib; part 10 #369233

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
b9b070a
nixos/services.manticore: remove `with lib;`
Stunkymonkey Dec 29, 2024
90934ea
nixos/services.meilisearch: remove `with lib;`
Stunkymonkey Dec 29, 2024
418f49a
nixos/services.opensearch: remove `with lib;`
Stunkymonkey Dec 29, 2024
0c00abe
nixos/services.qdrant: remove `with lib;`
Stunkymonkey Dec 29, 2024
ed344f1
nixos/services.quickwit: remove `with lib;`
Stunkymonkey Dec 29, 2024
e89c367
nixos/services.certmgr: remove `with lib;`
Stunkymonkey Dec 29, 2024
03977fb
nixos/services.cfssl: remove `with lib;`
Stunkymonkey Dec 29, 2024
8dbe325
nixos/services.clamav: remove `with lib;`
Stunkymonkey Dec 29, 2024
cd46072
nixos/services.endlessh-go: remove `with lib;`
Stunkymonkey Dec 29, 2024
57fa81e
nixos/services.endlessh: remove `with lib;`
Stunkymonkey Dec 29, 2024
f22a652
nixos/services.fail2ban: remove `with lib;`
Stunkymonkey Dec 29, 2024
4d9366e
nixos/services.fprintd: remove `with lib;`
Stunkymonkey Dec 29, 2024
1c7eaa7
nixos/services.haka: remove `with lib;`
Stunkymonkey Dec 29, 2024
f155ae8
nixos/services.haveged: remove `with lib;`
Stunkymonkey Dec 29, 2024
83ccb2a
nixos/services.hologram-agent: remove `with lib;`
Stunkymonkey Dec 29, 2024
3bb7989
nixos/services.hologram-server: remove `with lib;`
Stunkymonkey Dec 29, 2024
bd92ad1
nixos/services.infnoise: remove `with lib;`
Stunkymonkey Dec 29, 2024
bc6eb17
nixos/services.munge: remove `with lib;`
Stunkymonkey Dec 29, 2024
fe23e33
nixos/services.nginx.sso: remove `with lib;`
Stunkymonkey Dec 29, 2024
a8d3317
nixos/services.opensnitch: remove `with lib;`
Stunkymonkey Dec 29, 2024
9db6d6f
nixos/services.opensnitch: fmt
Stunkymonkey Dec 29, 2024
59dacf1
nixos/services.passSecretService: remove `with lib;`
Stunkymonkey Dec 29, 2024
ace6881
nixos/services.physlock: remove `with lib;`
Stunkymonkey Dec 29, 2024
c75c02d
nixos/services.physlock: fmt
Stunkymonkey Dec 29, 2024
f956ab7
nixos/services.sks: remove `with lib;`
Stunkymonkey Dec 29, 2024
5d73834
nixos/services.sshguard: remove `with lib;`
Stunkymonkey Dec 29, 2024
5bbc04a
nixos/services.sslmate-agent: remove `with lib;`
Stunkymonkey Dec 29, 2024
4beedae
nixos/services.tang: remove `with lib;`
Stunkymonkey Dec 29, 2024
a5b40fb
nixos/services.tor: remove `with lib;`
Stunkymonkey Dec 29, 2024
d929731
nixos/services.tor: fmt
Stunkymonkey Dec 29, 2024
edf46e7
nixos/services.tor.tsocks: remove `with lib;`
Stunkymonkey Dec 29, 2024
ee9d6cd
nixos/services.tor.torsocks: remove `with lib;`
Stunkymonkey Dec 29, 2024
4bcc603
nixos/services.usbguard: remove `with lib;`
Stunkymonkey Dec 29, 2024
10e015d
nixos/services.vault-agent: remove `with lib;`
Stunkymonkey Dec 29, 2024
c24987c
nixos/services.vault: remove `with lib;`
Stunkymonkey Dec 29, 2024
cae6481
nixos/services.vault: fmt
Stunkymonkey Dec 29, 2024
1f4bd3a
nixos/services.yubikey-agent: remove `with lib;`
Stunkymonkey Dec 29, 2024
3ef002a
nixos/services.yubikey-agent: fmt
Stunkymonkey Dec 29, 2024
fb31348
nixos/services.automatic-timezoned: remove `with lib;`
Stunkymonkey Dec 29, 2024
81f97e6
nixos/services.cachix-agent: remove `with lib;`
Stunkymonkey Dec 29, 2024
354e3ac
nixos/services.cachix-watch-store: remove `with lib;`
Stunkymonkey Dec 29, 2024
128623b
nixos/services.cloud-init: remove `with lib;`
Stunkymonkey Dec 29, 2024
08f1e99
nixos/services.localtimed: remove `with lib;`
Stunkymonkey Dec 29, 2024
0a49bde
nixos/nix: remove `with lib;`
Stunkymonkey Dec 29, 2024
710d618
nixos/services.nscd: remove `with lib;`
Stunkymonkey Dec 29, 2024
e8c85ce
nixos/services.saslauthd: remove `with lib;`
Stunkymonkey Dec 29, 2024
c05dd62
nixos/services.uptimed: remove `with lib;`
Stunkymonkey Dec 29, 2024
16c697e
nixos/services.deluge: remove `with lib;`
Stunkymonkey Dec 29, 2024
2718eb3
nixos/services.flexget: remove `with lib;`
Stunkymonkey Dec 29, 2024
fd713ac
nixos/services.magnetico: remove `with lib;`
Stunkymonkey Dec 29, 2024
4db4628
nixos/services.opentracker: remove `with lib;`
Stunkymonkey Dec 29, 2024
336a76b
nixos/services.peerflix: remove `with lib;`
Stunkymonkey Dec 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions nixos/modules/services/search/manticore.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,22 @@
pkgs,
...
}:

with lib;

let

cfg = config.services.manticore;
format = pkgs.formats.json { };

toSphinx =
{
mkKeyValue ? generators.mkKeyValueDefault { } "=",
mkKeyValue ? lib.generators.mkKeyValueDefault { } "=",
listsAsDuplicateKeys ? true,
}:
attrsOfAttrs:
let
# map function to string for each key val
mapAttrsToStringsSep =
sep: mapFn: attrs:
concatStringsSep sep (mapAttrsToList mapFn attrs);
lib.concatStringsSep sep (lib.mapAttrsToList mapFn attrs);
mkSection =
sectName: sectValues:
''
Expand All @@ -46,9 +43,9 @@ in
options = {
services.manticore = {

enable = mkEnableOption "Manticoresearch";
enable = lib.mkEnableOption "Manticoresearch";

settings = mkOption {
settings = lib.mkOption {
default = {
searchd = {
listen = [
Expand All @@ -67,10 +64,10 @@ in
<https://manual.manticoresearch.com/Server%20settings>
for more information.
'';
type = types.submodule {
type = lib.types.submodule {
freeformType = format.type;
};
example = literalExpression ''
example = lib.literalExpression ''
{
searchd = {
listen = [
Expand All @@ -90,7 +87,7 @@ in
};
};

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {

systemd = {
packages = [ pkgs.manticoresearch ];
Expand Down
47 changes: 22 additions & 25 deletions nixos/modules/services/search/meilisearch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
pkgs,
...
}:

with lib;

let
cfg = config.services.meilisearch;

in
{

meta.maintainers = with maintainers; [
meta.maintainers = with lib.maintainers; [
Br1ght0ne
happysalada
];
Expand All @@ -22,37 +19,37 @@ in
###### interface

options.services.meilisearch = {
enable = mkEnableOption "MeiliSearch - a RESTful search API";
enable = lib.mkEnableOption "MeiliSearch - a RESTful search API";

package = mkPackageOption pkgs "meilisearch" {
package = lib.mkPackageOption pkgs "meilisearch" {
extraDescription = ''
Use this if you require specific features to be enabled. The default package has no features.
'';
};

listenAddress = mkOption {
listenAddress = lib.mkOption {
description = "MeiliSearch listen address.";
default = "127.0.0.1";
type = types.str;
type = lib.types.str;
};

listenPort = mkOption {
listenPort = lib.mkOption {
description = "MeiliSearch port to listen on.";
default = 7700;
type = types.port;
type = lib.types.port;
};

environment = mkOption {
environment = lib.mkOption {
description = "Defines the running environment of MeiliSearch.";
default = "development";
type = types.enum [
type = lib.types.enum [
"development"
"production"
];
};

# TODO change this to LoadCredentials once possible
masterKeyEnvironmentFile = mkOption {
masterKeyEnvironmentFile = lib.mkOption {
description = ''
Path to file which contains the master key.
By doing so, all routes will be protected and will require a key to be accessed.
Expand All @@ -61,21 +58,21 @@ in
MEILI_MASTER_KEY=my_secret_key
'';
default = null;
type = with types; nullOr path;
type = with lib.types; nullOr path;
};

noAnalytics = mkOption {
noAnalytics = lib.mkOption {
description = ''
Deactivates analytics.
Analytics allow MeiliSearch to know how many users are using MeiliSearch,
which versions and which platforms are used.
This process is entirely anonymous.
'';
default = true;
type = types.bool;
type = lib.types.bool;
};

logLevel = mkOption {
logLevel = lib.mkOption {
description = ''
Defines how much detail should be present in MeiliSearch's logs.
MeiliSearch currently supports four log levels, listed in order of increasing verbosity:
Expand All @@ -86,36 +83,36 @@ in
Useful when diagnosing issues and debugging
'';
default = "INFO";
type = types.str;
type = lib.types.str;
};

maxIndexSize = mkOption {
maxIndexSize = lib.mkOption {
description = ''
Sets the maximum size of the index.
Value must be given in bytes or explicitly stating a base unit.
For example, the default value can be written as 107374182400, '107.7Gb', or '107374 Mb'.
Default is 100 GiB
'';
default = "107374182400";
type = types.str;
type = lib.types.str;
};

payloadSizeLimit = mkOption {
payloadSizeLimit = lib.mkOption {
description = ''
Sets the maximum size of accepted JSON payloads.
Value must be given in bytes or explicitly stating a base unit.
For example, the default value can be written as 107374182400, '107.7Gb', or '107374 Mb'.
Default is ~ 100 MB
'';
default = "104857600";
type = types.str;
type = lib.types.str;
};

};

###### implementation

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {

# used to restore dumps
environment.systemPackages = [ cfg.package ];
Expand All @@ -127,7 +124,7 @@ in
environment = {
MEILI_DB_PATH = "/var/lib/meilisearch";
MEILI_HTTP_ADDR = "${cfg.listenAddress}:${toString cfg.listenPort}";
MEILI_NO_ANALYTICS = boolToString cfg.noAnalytics;
MEILI_NO_ANALYTICS = lib.boolToString cfg.noAnalytics;
MEILI_ENV = cfg.environment;
MEILI_DUMP_DIR = "/var/lib/meilisearch/dumps";
MEILI_LOG_LEVEL = cfg.logLevel;
Expand All @@ -137,7 +134,7 @@ in
ExecStart = "${cfg.package}/bin/meilisearch";
DynamicUser = true;
StateDirectory = "meilisearch";
EnvironmentFile = mkIf (cfg.masterKeyEnvironmentFile != null) cfg.masterKeyEnvironmentFile;
EnvironmentFile = lib.mkIf (cfg.masterKeyEnvironmentFile != null) cfg.masterKeyEnvironmentFile;
};
};
};
Expand Down
15 changes: 6 additions & 9 deletions nixos/modules/services/search/opensearch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
pkgs,
...
}:

with lib;

let
cfg = config.services.opensearch;

Expand All @@ -28,7 +25,7 @@ in
{

options.services.opensearch = {
enable = mkEnableOption "OpenSearch";
enable = lib.mkEnableOption "OpenSearch";

package = lib.mkPackageOption pkgs "OpenSearch" {
default = [ "opensearch" ];
Expand Down Expand Up @@ -113,13 +110,13 @@ in
rootLogger.level = info
rootLogger.appenderRef.console.ref = console
'';
type = types.str;
type = lib.types.str;
};

dataDir = lib.mkOption {
type = lib.types.path;
default = "/var/lib/opensearch";
apply = converge (removeSuffix "/");
apply = lib.converge (lib.removeSuffix "/");
description = ''
Data directory for OpenSearch. If you change this, you need to
manually create the directory. You also need to create the
Expand Down Expand Up @@ -173,7 +170,7 @@ in
};
};

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
systemd.services.opensearch = {
description = "OpenSearch Daemon";
wantedBy = [ "multi-user.target" ];
Expand All @@ -194,7 +191,7 @@ in
set -o errexit -o pipefail -o nounset -o errtrace
shopt -s inherit_errexit
''
+ (optionalString (!config.boot.isContainer) ''
+ (lib.optionalString (!config.boot.isContainer) ''
# Only set vm.max_map_count if lower than ES required minimum
# This avoids conflict if configured via boot.kernel.sysctl
if [ $(${pkgs.procps}/bin/sysctl -n vm.max_map_count) -lt 262144 ]; then
Expand Down Expand Up @@ -268,7 +265,7 @@ in
TimeoutStartSec = "infinity";
DynamicUser = usingDefaultUserAndGroup && usingDefaultDataDir;
}
// (optionalAttrs (usingDefaultDataDir) {
// (lib.optionalAttrs (usingDefaultDataDir) {
StateDirectory = "opensearch";
StateDirectoryMode = "0700";
});
Expand Down
70 changes: 34 additions & 36 deletions nixos/modules/services/search/qdrant.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
pkgs,
...
}:

with lib;
let

cfg = config.services.qdrant;
Expand All @@ -17,9 +15,9 @@ in

options = {
services.qdrant = {
enable = mkEnableOption "Vector Search Engine for the next generation of AI applications";
enable = lib.mkEnableOption "Vector Search Engine for the next generation of AI applications";

settings = mkOption {
settings = lib.mkOption {
description = ''
Configuration for Qdrant
Refer to <https://github.com/qdrant/qdrant/blob/master/config/config.yaml> for details on supported values.
Expand All @@ -43,7 +41,7 @@ in
telemetry_disabled = true;
};

defaultText = literalExpression ''
defaultText = lib.literalExpression ''
{
storage = {
storage_path = "/var/lib/qdrant/storage";
Expand All @@ -64,41 +62,41 @@ in
};
};

config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
services.qdrant.settings = {
service.static_content_dir = mkDefault pkgs.qdrant-web-ui;
storage.storage_path = mkDefault "/var/lib/qdrant/storage";
storage.snapshots_path = mkDefault "/var/lib/qdrant/snapshots";
service.static_content_dir = lib.mkDefault pkgs.qdrant-web-ui;
storage.storage_path = lib.mkDefault "/var/lib/qdrant/storage";
storage.snapshots_path = lib.mkDefault "/var/lib/qdrant/snapshots";
# The following default values are the same as in the default config,
# they are just written here for convenience.
storage.on_disk_payload = mkDefault true;
storage.wal.wal_capacity_mb = mkDefault 32;
storage.wal.wal_segments_ahead = mkDefault 0;
storage.performance.max_search_threads = mkDefault 0;
storage.performance.max_optimization_threads = mkDefault 1;
storage.optimizers.deleted_threshold = mkDefault 0.2;
storage.optimizers.vacuum_min_vector_number = mkDefault 1000;
storage.optimizers.default_segment_number = mkDefault 0;
storage.optimizers.max_segment_size_kb = mkDefault null;
storage.optimizers.memmap_threshold_kb = mkDefault null;
storage.optimizers.indexing_threshold_kb = mkDefault 20000;
storage.optimizers.flush_interval_sec = mkDefault 5;
storage.optimizers.max_optimization_threads = mkDefault 1;
storage.hnsw_index.m = mkDefault 16;
storage.hnsw_index.ef_construct = mkDefault 100;
storage.hnsw_index.full_scan_threshold_kb = mkDefault 10000;
storage.hnsw_index.max_indexing_threads = mkDefault 0;
storage.hnsw_index.on_disk = mkDefault false;
storage.hnsw_index.payload_m = mkDefault null;
service.max_request_size_mb = mkDefault 32;
service.max_workers = mkDefault 0;
service.http_port = mkDefault 6333;
service.grpc_port = mkDefault 6334;
service.enable_cors = mkDefault true;
cluster.enabled = mkDefault false;
storage.on_disk_payload = lib.mkDefault true;
storage.wal.wal_capacity_mb = lib.mkDefault 32;
storage.wal.wal_segments_ahead = lib.mkDefault 0;
storage.performance.max_search_threads = lib.mkDefault 0;
storage.performance.max_optimization_threads = lib.mkDefault 1;
storage.optimizers.deleted_threshold = lib.mkDefault 0.2;
storage.optimizers.vacuum_min_vector_number = lib.mkDefault 1000;
storage.optimizers.default_segment_number = lib.mkDefault 0;
storage.optimizers.max_segment_size_kb = lib.mkDefault null;
storage.optimizers.memmap_threshold_kb = lib.mkDefault null;
storage.optimizers.indexing_threshold_kb = lib.mkDefault 20000;
storage.optimizers.flush_interval_sec = lib.mkDefault 5;
storage.optimizers.max_optimization_threads = lib.mkDefault 1;
storage.hnsw_index.m = lib.mkDefault 16;
storage.hnsw_index.ef_construct = lib.mkDefault 100;
storage.hnsw_index.full_scan_threshold_kb = lib.mkDefault 10000;
storage.hnsw_index.max_indexing_threads = lib.mkDefault 0;
storage.hnsw_index.on_disk = lib.mkDefault false;
storage.hnsw_index.payload_m = lib.mkDefault null;
service.max_request_size_mb = lib.mkDefault 32;
service.max_workers = lib.mkDefault 0;
service.http_port = lib.mkDefault 6333;
service.grpc_port = lib.mkDefault 6334;
service.enable_cors = lib.mkDefault true;
cluster.enabled = lib.mkDefault false;
# the following have been altered for security
service.host = mkDefault "127.0.0.1";
telemetry_disabled = mkDefault true;
service.host = lib.mkDefault "127.0.0.1";
telemetry_disabled = lib.mkDefault true;
};

systemd.services.qdrant = {
Expand Down
Loading
Loading