mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
generate more data logic
This commit is contained in:
parent
b666e47a6e
commit
5e09bb8ea6
16 changed files with 8867 additions and 8758 deletions
36
nix/data-mod.nix
Normal file
36
nix/data-mod.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
packages,
|
||||
lib,
|
||||
writeTextDir,
|
||||
}: let
|
||||
inherit (builtins) head attrNames concatStringsSep replaceStrings;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.lists) flatten last;
|
||||
module_name = name: version: "${name}_${replaceStrings ["."] ["_"] version}";
|
||||
matches_for = name: mapAttrsToList (version: data: ''("${name}", "${version}") => Some(("${data.prefix or ""}", ${module_name name version}::STATEMENTS)),'');
|
||||
imports_for = name: mapAttrsToList (version: _: ''mod ${module_name name version};'');
|
||||
matches = flatten (mapAttrsToList matches_for packages);
|
||||
imports = flatten (mapAttrsToList imports_for packages);
|
||||
min_versions = mapAttrsToList (name: versions: ''("${name}", "${head (attrNames versions)}"),'') packages;
|
||||
max_versions = mapAttrsToList (name: versions: ''("${name}", "${last (attrNames versions)}"),'') packages;
|
||||
code = ''
|
||||
use crate::LoggingStatement;
|
||||
|
||||
${concatStringsSep "\n" imports}
|
||||
|
||||
pub const MIN_VERSIONS: &[(&str, &str)] = &[
|
||||
${concatStringsSep "\n" min_versions}
|
||||
];
|
||||
|
||||
pub const MAX_VERSIONS: &[(&str, &str)] = &[
|
||||
${concatStringsSep "\n" max_versions}
|
||||
];
|
||||
|
||||
pub fn get_statements_for(name: &str, version: &str) -> Option<(&'static str, &'static [LoggingStatement])> {
|
||||
match (name, version) {
|
||||
${concatStringsSep "\n" matches}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
'';
|
||||
in writeTextDir "mod.rs" code
|
||||
|
|
@ -18,13 +18,14 @@ in {
|
|||
logging-extractor = final.callPackage ./logging-extractor.nix {};
|
||||
extracted-logs-parts = mapAttrs (loggingFor "json") packages;
|
||||
extracted-logs-parts-rust = mapAttrs (loggingFor "rust") packages;
|
||||
extracted-logs-rust-mod = final.callPackage ./data-mod.nix {inherit packages;};
|
||||
extracted-logs = symlinkJoin {
|
||||
name = "extracted-logs";
|
||||
paths = flatten (map attrValues (attrValues final.extracted-logs-parts));
|
||||
};
|
||||
extracted-logs-rust = symlinkJoin {
|
||||
name = "extracted-logs";
|
||||
paths = flatten (map attrValues (attrValues final.extracted-logs-parts-rust));
|
||||
paths = (flatten (map attrValues (attrValues final.extracted-logs-parts-rust))) ++ [final.extracted-logs-rust-mod];
|
||||
};
|
||||
logsmash = final.callPackage ./package.nix {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,21 +35,24 @@
|
|||
"1.19": {
|
||||
"version": "1.19.1",
|
||||
"url": "https://github.com/nextcloud-releases/files_accesscontrol/releases/download/v1.19.1/files_accesscontrol-v1.19.1.tar.gz",
|
||||
"sha256": "sha256-e9387k5yn3lAZ7uN0YU8zNVkX8sCoNxyc5M3E3azo80="
|
||||
"sha256": "sha256-e9387k5yn3lAZ7uN0YU8zNVkX8sCoNxyc5M3E3azo80=",
|
||||
"prefix": "/apps/files_accesscontrol"
|
||||
}
|
||||
},
|
||||
"files_antivirus": {
|
||||
"5.5": {
|
||||
"version": "5.5.7",
|
||||
"url": "https://github.com/nextcloud-releases/files_antivirus/releases/download/v5.5.7/files_antivirus-v5.5.7.tar.gz",
|
||||
"sha256": "sha256-Sg6AeqopaXrXrZ6loq+B5ZBjh2SHIflXaf6u/cIBqUo="
|
||||
"sha256": "sha256-Sg6AeqopaXrXrZ6loq+B5ZBjh2SHIflXaf6u/cIBqUo=",
|
||||
"prefix": "/apps/files_antivirus"
|
||||
}
|
||||
},
|
||||
"deck": {
|
||||
"1.13": {
|
||||
"version": "1.31.1",
|
||||
"url": "https://github.com/nextcloud-releases/deck/releases/download/v1.13.1/deck-v1.13.1.tar.gz",
|
||||
"sha256": "sha256-AQV2JeSrQcPSh2J2oG/Kbrh2Qo/nj1+orYJymDsQLDQ="
|
||||
"sha256": "sha256-AQV2JeSrQcPSh2J2oG/Kbrh2Qo/nj1+orYJymDsQLDQ=",
|
||||
"prefix": "/apps/deck"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue