Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xcursor-pro: init at 2.0.2 #335188

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11617,6 +11617,12 @@
github = "lachrymaLF";
githubId = 13716477;
};
lactose = {
juuyokka marked this conversation as resolved.
Show resolved Hide resolved
name = "lactose";
email = "lactose@allthingslinux.com";
github = "juuyokka";
githubId = 15185244;
};
lafrenierejm = {
email = "joseph@lafreniere.xyz";
github = "lafrenierejm";
Expand Down
54 changes: 54 additions & 0 deletions pkgs/by-name/xc/xcursor-pro/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
stdenvNoCC,
lib,
fetchurl,
variants ? [ ],
}:

let
sources = import ./sources.nix;
knownVariants = builtins.attrNames sources;
selectedVariants =
if (variants == [ ]) then
knownVariants
else
let
unknownVariants = lib.subtractLists knownVariants variants;
in
if (unknownVariants != [ ]) then
throw "Unknown variant(s): ${lib.concatStringsSep unknownVariants}"
else
variants;
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "xcursor-pro";
version = "2.0.2";
srcs = map (variant: fetchurl { inherit (sources.${variant}) url sha256; }) selectedVariants;

sourceRoot = ".";
juuyokka marked this conversation as resolved.
Show resolved Hide resolved

installPhase = ''
runHook preInstall

for theme in XCursor-Pro-{${lib.concatStringsSep "," selectedVariants}}; do
mkdir -p $out/share/icons/$theme/cursors
cp -a $theme/cursors/* $out/share/icons/$theme/cursors/
install -m644 $theme/index.theme $out/share/icons/$theme/index.theme
done

runHook postInstall
'';

passthru.updateScript = ./update.sh;

meta = {
homepage = "https://github.com/ful1e5/XCursor-pro";
description = "Modern XCursors";
license = lib.licenses.gpl3;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
lactose
midirhee12
];
};
})
15 changes: 15 additions & 0 deletions pkgs/by-name/xc/xcursor-pro/sources.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
Dark = {
url = "https://github.com/ful1e5/XCursor-pro/releases/download/v2.0.2/XCursor-Pro-Dark.tar.xz";
sha256 = "12r7b2wygasl5yk0k5m6b640q4b23k072myzpz8s5jkyvnp3p84n";
};
Light = {
url = "https://github.com/ful1e5/XCursor-pro/releases/download/v2.0.2/XCursor-Pro-Light.tar.xz";
sha256 = "19vddq8ajdxxzl3fnvac7p4lmb2hvyszpl25f5nmpm84xwp1kdla";
};
Red = {
url = "https://github.com/ful1e5/XCursor-pro/releases/download/v2.0.2/XCursor-Pro-Red.tar.xz";
sha256 = "00rhqmcfczy3nvk95rgy22mi6yqpp7ggbxck1z0ay2qv6cfics9m";
};
}
# old version was 2.0.1
36 changes: 36 additions & 0 deletions pkgs/by-name/xc/xcursor-pro/update.sh
JohnRTitor marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch jq
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#! nix-shell -i bash -p nix-prefetch jq
#!nix-shell -i bash -p nix-prefetch jq

Small nitpick.


latest_release=$(curl --silent https://api.github.com/repos/ful1e5/XCursor-pro/releases/latest)
version=$(jq -r '.tag_name' <<<"$latest_release")
version="${version#*v}"

dirname="$(dirname "$0")"
if [ "$UPDATE_NIX_OLD_VERSION" = "$version" ]; then
printf 'No new version available, current: %s\n' $version
exit 0
else
printf 'Updated to version %s\n' $version
sed -i "s/version = \"$UPDATE_NIX_OLD_VERSION\"/version = \"$version\"/" "$dirname/package.nix"
fi

printf '{\n' > "$dirname/sources.nix"

while
read -r name
read -r url
do
variant="${name#*-*-}"
variant="${variant%%.*}"

{
printf ' %s = {\n' "$variant"
printf ' url = \"%s\";\n' "$url"
printf ' sha256 = \"%s\";\n' "$(nix-prefetch-url "$url")"
printf ' };\n'
} >> "$dirname/sources.nix"
done < <(jq -r '.assets[] |
select(.name | endswith(".tar.xz") and (contains("all") | not)) |
.name, .browser_download_url' <<<"$latest_release")

printf '}\n' >> "$dirname/sources.nix"