Merge pull request #160726: dash-to-dock: Build from source again

gnomeExtensions.dash-to-dock: Build from source again
This commit is contained in:
piegames 2022-02-19 12:18:55 +01:00 committed by GitHub
commit bb04f169d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 123 additions and 13 deletions

View File

@ -10,38 +10,103 @@
# commit.
{ url ? null # The git url, if empty it will be set to src.url
, branch ? null
, stableVersion ? false # Use version format according to RFC 107 (i.e. LAST_TAG+date=YYYY-MM-DD)
, tagPrefix ? "" # strip this prefix from a tag name when using stable version
}:
let
updateScript = writeShellScript "unstable-update-script.sh" ''
set -ex
url="$1"
url=""
branch=""
use_stable_version=""
tag_prefix=""
while (( $# > 0 )); do
flag="$1"
shift 1
case "$flag" in
--url=*)
url="''${flag#*=}"
;;
--branch=*)
branch="''${flag#*=}"
;;
--use-stable-version)
use_stable_version=1
;;
--tag-prefix=*)
tag_prefix="''${flag#*=}"
;;
*)
echo "$0: unknown option ''${flag}"
exit 1
;;
esac
done
# By default we set url to src.url
if [[ -z "$url" ]]; then
url="$(${nix}/bin/nix-instantiate $systemArg --eval -E \
"with import ./. {}; $UPDATE_NIX_ATTR_PATH.src.url" \
"with import ./. {}; $UPDATE_NIX_ATTR_PATH.src.url or $UPDATE_NIX_ATTR_PATH.src.meta.homepage" \
| tr -d '"')"
fi
# Get info about HEAD from a shallow git clone
tmpdir="$(${coreutils}/bin/mktemp -d)"
${git}/bin/git clone --bare --depth=1 \
${lib.optionalString (branch != null) "--branch ${branch}"} \
"$url" "$tmpdir"
cloneArgs=(
--bare
--depth=1
)
if [[ -n "$branch" ]]; then
cloneArgs+=(--branch="$branch")
fi
${git}/bin/git clone "''${cloneArgs[@]}" "$url" "$tmpdir"
pushd "$tmpdir"
commit_date="$(${git}/bin/git show -s --pretty='format:%cs')"
commit_sha="$(${git}/bin/git show -s --pretty='format:%H')"
if [[ -z "$use_stable_version" ]]; then
new_version="unstable-$commit_date"
else
depth=100
while (( $depth < 10000 )); do
last_tag="$(${git}/bin/git describe --tags --abbrev=0 2> /dev/null || true)"
if [[ -n "$last_tag" ]]; then
break
fi
${git}/bin/git fetch --depth="$depth" --tags
depth=$(( $depth * 2 ))
done
if [[ -z "$last_tag" ]]; then
echo "Cound not found a tag within last 10000 commits" > /dev/stderr
exit 1
fi
if [[ -n "$tag_prefix" ]]; then
last_tag="''${last_tag#$tag_prefix}"
fi
new_version="$last_tag+date=$commit_date"
fi
popd
${coreutils}/bin/rm -rf "$tmpdir"
# ${coreutils}/bin/rm -rf "$tmpdir"
# update the nix expression
${common-updater-scripts}/bin/update-source-version \
"$UPDATE_NIX_ATTR_PATH" \
"unstable-$commit_date" \
"$new_version" \
--rev="$commit_sha"
'';
in [ updateScript url ]
in [
updateScript
"--url=${builtins.toString url}"
] ++ lib.optionals (branch != null) [
"--branch=${branch}"
] ++ lib.optionals stableVersion [
"--use-stable-version"
"--tag-prefix=${tagPrefix}"
]

View File

@ -0,0 +1,48 @@
{ stdenv
, lib
, fetchFromGitHub
, glib
, gettext
, sassc
, unstableGitUpdater
}:
stdenv.mkDerivation rec {
pname = "gnome-shell-extension-dash-to-dock";
version = "71+date=2022-01-24";
# Temporarily switched to commit hash because stable version is buggy.
src = fetchFromGitHub {
owner = "micheleg";
repo = "dash-to-dock";
rev = "53114b4e000482a753e8b42dfa10d6057c08d1c6";
sha256 = "Gv78I/dxhc6FpjZWk10uHBfD24tHE4KdkpaAo8UZpwU=";
};
nativeBuildInputs = [
glib
gettext
sassc
];
makeFlags = [
"INSTALLBASE=${placeholder "out"}/share/gnome-shell/extensions"
];
passthru = {
extensionUuid = "dash-to-dock@micxgx.gmail.com";
extensionPortalSlug = "dash-to-dock";
updateScript = unstableGitUpdater {
stableVersion = true;
tagPrefix = "extensions.gnome.org-v";
};
};
meta = with lib; {
description = "A dock for the Gnome Shell";
homepage = "https://micheleg.github.io/dash-to-dock/";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ eperuffo jtojnar rhoriguchi ];
};
}

View File

@ -28,10 +28,6 @@ super: lib.trivial.pipe super [
meta.maintainers = with lib.maintainers; [ eperuffo ];
}))
(patchExtension "dash-to-dock@micxgx.gmail.com" (old: {
meta.maintainers = with lib.maintainers; [ eperuffo jtojnar rhoriguchi ];
}))
(patchExtension "ddterm@amezin.github.com" (old: {
# Requires gjs, zenity & vte via the typelib
nativeBuildInputs = [ gobject-introspection wrapGAppsHook ];

View File

@ -2,6 +2,7 @@
{
"arcmenu@arcmenu.com" = callPackage ./arcmenu { };
"clock-override@gnomeshell.kryogenix.org" = callPackage ./clock-override { };
"dash-to-dock@micxgx.gmail.com" = callPackage ./dash-to-dock { };
"drop-down-terminal@gs-extensions.zzrough.org" = callPackage ./drop-down-terminal { };
"EasyScreenCast@iacopodeenosee.gmail.com" = callPackage ./EasyScreenCast { };
"emoji-selector@maestroschan.fr" = callPackage ./emoji-selector { };