nixVersions.*: patch for compatibility with lowdown >= 3.0

This commit is contained in:
sternenseemann
2026-03-29 15:00:28 -07:00
committed by Philip Taron
parent 9449884f4b
commit b428932fc6
2 changed files with 61 additions and 13 deletions
+34 -13
View File
@@ -134,6 +134,21 @@ let
patches_common = lib.optional (
stdenv.system == "aarch64-darwin"
) ./patches/skip-flaky-darwin-tests.patch;
# Lowdown 3.0 compatibility patch for nix 2.312.33; fetched from the
# upstream backport (same diff on every maintenance branch after
# fetchpatch strips metadata). Nix 2.34.4+ and the git snapshot
# already include the fix in their tagged source.
lowdown30Patch = pkgs.fetchpatch {
name = "nix-lowdown-3.0-support.patch";
url = "https://github.com/NixOS/nix/commit/472c35c561bd9e8db1465e0677f1efe2cb88c568.patch";
hash = "sha256-ZCQgI/euBN8t9rgdCsGRgrcEWG3T5MUc+bQc4tIcHuI=";
};
# Lowdown 3.0 compatibility patch for nix 2.28 and 2.30, which have a
# different markdown.cc layout (no LOWDOWN_TERM_NORELLINK branch) and
# never received an upstream backport.
lowdown30PatchOld = ./patches/lowdown-3.0-compat-2.28-2.30.patch;
in
lib.makeExtensible (
self:
@@ -149,6 +164,7 @@ lib.makeExtensible (
url = "https://github.com/NixOS/nix/commit/5a64138e862fe364e751c5c286e8db8c466aaee7.patch?full_index=1";
hash = "sha256-vFv/D08x9urtoIE9wiC7Lln4Eq3sgNBwU7TBE1iyrfI=";
})
lowdown30PatchOld
];
};
@@ -172,22 +188,27 @@ lib.makeExtensible (
url = "https://github.com/NixOS/nix/commit/5cbd7856de0a9c13351f98e32a1e26d0854d87fd.patch?full_index=1";
hash = "sha256-r2ZF1zBZDKMvyX6X4VsaTMrg0zdjn59Jf6Hqg56r29E=";
})
lowdown30PatchOld
]
);
nix_2_30 = addTests "nix_2_30" self.nixComponents_2_30.nix-everything;
nixComponents_2_31 = nixDependencies.callPackage ./modular/packages.nix rec {
version = "2.31.3";
inherit (self.nix_2_30.meta) teams;
otherSplices = generateSplicesForNixComponents "nixComponents_2_31";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
tag = version;
hash = "sha256-oe0YWe8f+pwQH4aYD2XXLW5iEHyXNUddurqJ5CUVCIk=";
};
};
nixComponents_2_31 =
(nixDependencies.callPackage ./modular/packages.nix rec {
version = "2.31.3";
inherit (self.nix_2_30.meta) teams;
otherSplices = generateSplicesForNixComponents "nixComponents_2_31";
src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
tag = version;
hash = "sha256-oe0YWe8f+pwQH4aYD2XXLW5iEHyXNUddurqJ5CUVCIk=";
};
}).appendPatches
[
lowdown30Patch
];
nix_2_31 = addTests "nix_2_31" self.nixComponents_2_31.nix-everything;
@@ -203,7 +224,7 @@ lib.makeExtensible (
hash = "sha256-5aH3xppfBs8j6P7A2wq8WQ05yJvlL7x0gQbWk4RN5eY=";
};
}).appendPatches
patches_common;
(patches_common ++ [ lowdown30Patch ]);
nix_2_32 = addTests "nix_2_32" self.nixComponents_2_32.nix-everything;
@@ -219,7 +240,7 @@ lib.makeExtensible (
hash = "sha256-2Mga4e9ZtOPLwYqF4+hcjdsTImcA7TKUvDDfaF7jqEo=";
};
}).appendPatches
patches_common;
(patches_common ++ [ lowdown30Patch ]);
nix_2_33 = addTests "nix_2_33" self.nixComponents_2_33.nix-everything;
@@ -0,0 +1,27 @@
--- a/src/libcmd/markdown.cc
+++ b/src/libcmd/markdown.cc
@@ -37,7 +37,13 @@
.vmargin = 0,
# endif
.feat = LOWDOWN_COMMONMARK | LOWDOWN_FENCED | LOWDOWN_DEFLIST | LOWDOWN_TABLES,
- .oflags = LOWDOWN_TERM_NOLINK,
+ .oflags =
+# if HAVE_LOWDOWN_3
+ LOWDOWN_NOLINK
+# else
+ LOWDOWN_TERM_NOLINK
+# endif
+ ,
};
auto doc = lowdown_doc_new(&opts);
--- a/src/libcmd/meson.build
+++ b/src/libcmd/meson.build
@@ -36,6 +36,7 @@
configdata.set('HAVE_LOWDOWN', lowdown.found().to_int())
# The API changed slightly around terminal initialization.
configdata.set('HAVE_LOWDOWN_1_4', lowdown.version().version_compare('>= 1.4.0').to_int())
+configdata.set('HAVE_LOWDOWN_3', lowdown.version().version_compare('>= 3.0.0').to_int())
readline_flavor = get_option('readline-flavor')
if readline_flavor == 'editline'