From 74307df8e3e78be893e8dd69bc59b5e94fb8b47e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandra=20=C3=98stermark?= Date: Thu, 13 Nov 2025 11:30:23 +0100 Subject: [PATCH] comments descriping the unreadable yaml generation --- nixarr/recyclarr/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nixarr/recyclarr/default.nix b/nixarr/recyclarr/default.nix index 248635c..b21372c 100644 --- a/nixarr/recyclarr/default.nix +++ b/nixarr/recyclarr/default.nix @@ -8,10 +8,14 @@ with lib; let cfg = config.nixarr.recyclarr; globals = config.util-nixarr.globals; nixarr = config.nixarr; + # This is a carbon copy of the yaml implementation in nixpkgs https://github.com/NixOS/nixpkgs/blob/fde6c4aec177afa2d0248b1c5983e2a72a231442/pkgs/pkgs-lib/formats.nix#L210-L231 + # except we've replaced json2yaml for yq-go to allow it to parse custom yaml tags + # ideally this would some day be upstreamed, see https://github.com/NixOS/nix/issues/4910 and https://github.com/rasmus-kirk/nixarr/issues/91 yamlGenerator = {preserved-tags ? []}: let selectors = - pkgs.lib.strings.concatStringsSep "/" + pkgs.lib.strings.concatStringsSep "|" (builtins.map ( + # this is yq for "for all the scalers, if they match this regex, do a regex substitution and set the tag" x: '' with((.. | select(kind == "scalar") | select(test("^!${x} .*"))); . = sub("!${x} ", "") | . tag="!${x}") ''