fix(3p/overlays): correctly assert tdlib<>telega.el matches
Extracts the required version out of the telega.el Dockerfile (this seems to be the authoritative source), and matches that against what nixpkgs has. In a future commit I'll improve this to reduce the likelihood of blocking a channel bump (by also pinning tdlib, and issuing warnings when nixpkgs has a newer telega/tdlib). Change-Id: I1129c1f6b38aa58eb8661f2ad9bc6fa19382d81c Reviewed-on: https://cl.tvl.fyi/c/depot/+/13220 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
211c2d42fa
commit
b32a95c206
2 changed files with 22 additions and 44 deletions
30
third_party/overlays/tvl.nix
vendored
30
third_party/overlays/tvl.nix
vendored
|
|
@ -90,16 +90,26 @@ depot.nix.readTree.drvTargets {
|
|||
};
|
||||
};
|
||||
|
||||
# Override telega sources until MELPA updates in nixpkgs resume.
|
||||
telega = esuper.telega.overrideAttrs (_: {
|
||||
version = "0.8.291"; # unstable
|
||||
src = self.fetchFromGitHub {
|
||||
owner = "zevlg";
|
||||
repo = "telega.el";
|
||||
rev = "58b4963b292ceb723d665df100b519eb5a99c676";
|
||||
sha256 = "1q3ydbm0jhrsyvvdn0mpmxvskq0l53jkh40a5hlx7i3qkinbhbry";
|
||||
};
|
||||
});
|
||||
# Override telega sources to specific commits, and check its exact tdlib version requirement.
|
||||
checkedTelega =
|
||||
let
|
||||
pinned = esuper.telega.overrideAttrs (_: {
|
||||
version = "0.8.999"; # unstable
|
||||
src = self.fetchFromGitHub {
|
||||
owner = "zevlg";
|
||||
repo = "telega.el";
|
||||
rev = "431c8d8c6388b8e77548d68da70a1eb44f562a98";
|
||||
sha256 = "0q6ljzlfzkf59rd86qd47yilny17k9gq4plv20lisk4i3213fzdh";
|
||||
};
|
||||
});
|
||||
|
||||
requiredTdlibFile = self.runCommandNoCC "required-tdlib" { } ''
|
||||
${self.ripgrep}/bin/rg -o -r '$1' 'tdlib_version=v(.*)$' ${pinned.src}/etc/Dockerfile > $out
|
||||
'';
|
||||
|
||||
requiredTdlib = self.lib.strings.trim (builtins.readFile "${requiredTdlibFile}");
|
||||
in
|
||||
assert requiredTdlib == self.tdlib.version; pinned; # ping tazjin if this fails
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,9 @@ pkgs.makeOverridable
|
|||
emacsPackages = (pkgs.emacsPackagesFor emacs);
|
||||
emacsWithPackages = emacsPackages.emacsWithPackages;
|
||||
|
||||
# If switching telega versions, use this variable because it will
|
||||
# keep the version check, binary path and so on in sync.
|
||||
currentTelega = epkgs: epkgs.telega;
|
||||
|
||||
# $PATH for binaries that need to be available to Emacs
|
||||
emacsBinPath = lib.makeBinPath [
|
||||
(currentTelega pkgs.emacsPackages)
|
||||
emacsPackages.checkedTelega
|
||||
pkgs.libwebp # for dwebp, required by telega
|
||||
];
|
||||
|
||||
|
|
@ -105,7 +101,7 @@ pkgs.makeOverridable
|
|||
zoxide
|
||||
|
||||
# Wonky stuff
|
||||
(currentTelega epkgs)
|
||||
checkedTelega
|
||||
customTreesitGrammars # TODO(tazjin): how is this *supposed* to work?!
|
||||
|
||||
# Custom depot packages (either ours, or overridden ones)
|
||||
|
|
@ -121,29 +117,6 @@ pkgs.makeOverridable
|
|||
# Dynamic/native modules
|
||||
depot.users.tazjin.gio-list-apps
|
||||
])));
|
||||
|
||||
# Tired of telega.el runtime breakages through tdlib
|
||||
# incompatibility. Target to make that a build failure instead.
|
||||
tdlibCheck =
|
||||
let
|
||||
tgEmacs = emacsWithPackages (epkgs: [ (currentTelega epkgs) ]);
|
||||
verifyTdlibVersion = builtins.toFile "verify-tdlib-version.el" ''
|
||||
(require 'telega)
|
||||
(defvar tdlib-version "${pkgs.tdlib.version}")
|
||||
(when (or (version< tdlib-version
|
||||
telega-tdlib-min-version)
|
||||
(and telega-tdlib-max-version
|
||||
(version< telega-tdlib-max-version
|
||||
tdlib-version)))
|
||||
(message "Found TDLib version %s, but require %s to %s"
|
||||
tdlib-version telega-tdlib-min-version telega-tdlib-max-version)
|
||||
(kill-emacs 1))
|
||||
'';
|
||||
in
|
||||
pkgs.runCommand "tdlibCheck" { } ''
|
||||
export PATH="${emacsBinPath}:$PATH"
|
||||
${tgEmacs}/bin/emacs --script ${verifyTdlibVersion} && touch $out
|
||||
'';
|
||||
in
|
||||
lib.fix
|
||||
(self: l: f: (pkgs.writeShellScriptBin "tazjins-emacs" ''
|
||||
|
|
@ -173,11 +146,6 @@ pkgs.makeOverridable
|
|||
# Call withLocalConfig with the path to a *folder* containing a
|
||||
# `local.el` which provides local system configuration.
|
||||
withLocalConfig = confDir: self confDir f;
|
||||
|
||||
# Expose telega/tdlib version check as a target that is built in
|
||||
# CI.
|
||||
inherit tdlibCheck;
|
||||
meta.ci.targets = [ "tdlibCheck" ];
|
||||
};
|
||||
}))
|
||||
null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue