1
1
mirror of https://github.com/wez/wezterm.git synced 2024-08-16 17:50:28 +03:00

nix: fix version string

Derive the version string using available information. This will work well for
clones of this repository, but not pure sources (e.g. GitHub source downloads).

Additionally, don't override the version found in existing .tag to allow actual
version to be specified manually. The side effect of this is that the actual
version might differ from that of the derivation, but there are no trivial
workarounds to set the derivation version based on existing .tag file given
that the flakes are stored in a subdirectory instead of the root of the
repository.
This commit is contained in:
Steven Kou 2024-02-08 23:32:59 -05:00
parent a7d9cfd25f
commit cbdcc665af
No known key found for this signature in database
GPG Key ID: D0D4BCFA8DB68E35

View File

@ -87,13 +87,19 @@
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
};
in {
packages.default = rustPlatform.buildRustPackage rec {
inherit buildInputs nativeBuildInputs;
name = "wezterm";
src = ./..;
version = self.shortRev or "dev";
version = if self ? submodules
then builtins.concatStringsSep "-"
(builtins.match "(.{8})(.{6})" self.lastModifiedDate
++ [ (builtins.substring 0 8 self.rev or self.dirtyRev) ]
++ lib.lists.optional (self ? dirtyRev) "dirty")
else "0-unknown";
cargoLock = {
lockFile = ../Cargo.lock;
@ -113,7 +119,9 @@
'';
postPatch = ''
echo ${version} > .tag
if [ ! -f .tag ]; then
echo ${version} > .tag
fi
# tests are failing with: Unable to exchange encryption keys
rm -r wezterm-ssh/tests