Unverified Commit 10295c91 authored by Michael Daniels's avatar Michael Daniels
Browse files

kitti3: standardize version number, set updateScript



This is the same version as before, despite the date difference.

This will prevent downgrade PRs.

Co-authored-by: default avatarSandro Jäckel <sandro.jaeckel@gmail.com>
parent 9c81a0c5
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
{
  buildPythonApplication,
  fetchFromGitHub,
  poetry-core,
  i3ipc,
  lib,
  poetry-core,
  writeScript,
}:

buildPythonApplication {
buildPythonApplication rec {
  pname = "kitti3";
  version = "unstable-2021-09-11";
  format = "pyproject";
  version = "0.5.1-unstable-2021-09-10";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "LandingEllipse";
@@ -32,6 +33,25 @@ buildPythonApplication {
    i3ipc
  ];

  passthru.updateScript = writeScript "update-kitti3" ''
    #!/usr/bin/env nix-shell
    #!nix-shell -i bash -p git common-updater-scripts perl tomlq
    tmpdir="$(mktemp -d)"
    trap "rm -rf $tmpdir" EXIT
    git clone --depth=1 "${src.gitRepoUrl}" "$tmpdir"
    pushd "$tmpdir"
    newVersionNumber=$(perl -ne 'print if s/version = "([\d.]+)"/$1/' pyproject.toml)
    newRevision=$(git show -s --pretty='format:%H')
    newDate=$(git show -s --pretty='format:%cs')
    newVersion="$newVersionNumber-unstable-$newDate"
    echo "newVersion = $newVersion" >&2
    echo "newRevision = $newRevision" >&2
    popd
    update-source-version --rev="$newRevision" "kitti3" "$newVersion"
    perl -pe 's/^(.*version = ")([\d\.]+)(.*)$/''${1}'"''${newVersion}"'";/' \
      -i 'pkgs/applications/window-managers/i3/kitti3.nix'
  '';

  meta = {
    homepage = "https://github.com/LandingEllipse/kitti3";
    description = "Kitty drop-down service for sway & i3wm";