mirror of
https://codeberg.org/icewind/log-normalizer.git
synced 2026-06-03 13:54:11 +02:00
flake reorg
This commit is contained in:
parent
9bd74a5a29
commit
6fe18f9771
30 changed files with 146 additions and 214 deletions
79
nix/module.nix
Normal file
79
nix/module.nix
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.services.log-normalizer;
|
||||
in {
|
||||
options.services.log-normalizer = {
|
||||
enable = mkEnableOption "Log normalizer";
|
||||
|
||||
user = mkOption {
|
||||
type = types.str;
|
||||
description = "user to run as";
|
||||
};
|
||||
|
||||
databaseUrlFile = mkOption {
|
||||
type = types.str;
|
||||
description = "file containg DATABASE_URL variable";
|
||||
};
|
||||
|
||||
rawDatabaseUrlFile = mkOption {
|
||||
type = types.str;
|
||||
description = "file containg RAW_DATABASE_URL variable";
|
||||
};
|
||||
|
||||
logLevel = mkOption {
|
||||
type = types.str;
|
||||
default = "info,sqlx=warn";
|
||||
description = "log level";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
description = "package to use";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.log-normalizer = {
|
||||
wantedBy = ["multi-user.target"];
|
||||
environment = {
|
||||
RUST_LOG = cfg.logLevel;
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
EnvironmentFile = [cfg.databaseUrlFile cfg.rawDatabaseUrlFile];
|
||||
ExecStart = "${cfg.package}/bin/log-normalizer";
|
||||
Restart = "on-failure";
|
||||
User = cfg.user;
|
||||
PrivateTmp = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
NoNewPrivileges = true;
|
||||
PrivateDevices = true;
|
||||
ProtectClock = true;
|
||||
CapabilityBoundingSet = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectControlGroups = true;
|
||||
SystemCallArchitectures = "native";
|
||||
ProtectKernelModules = true;
|
||||
RestrictNamespaces = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
ProtectHostname = true;
|
||||
LockPersonality = true;
|
||||
ProtectKernelTunables = true;
|
||||
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX";
|
||||
RestrictRealtime = true;
|
||||
ProtectProc = "noaccess";
|
||||
SystemCallFilter = ["@system-service" "~@resources" "~@privileged"];
|
||||
IPAddressDeny = "any";
|
||||
IPAddressAllow = "localhost";
|
||||
PrivateUsers = true;
|
||||
ProcSubset = "pid";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
3
nix/overlay.nix
Normal file
3
nix/overlay.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
final: prev: {
|
||||
log-normalizer = final.callPackage ./package.nix {};
|
||||
}
|
||||
20
nix/package.nix
Normal file
20
nix/package.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
lib,
|
||||
}: let
|
||||
inherit (lib.sources) sourceByRegex;
|
||||
src = sourceByRegex ../. ["Cargo.*" "(src|tests|.sqlx)(/.*)?"];
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "log-normalizer";
|
||||
version = "0.1.0";
|
||||
|
||||
SQLX_OFFLINE = 1;
|
||||
|
||||
inherit src;
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ../Cargo.lock;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue