diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 9717c09abe4b9..54bb93eea339b 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -11617,6 +11617,12 @@ github = "lachrymaLF"; githubId = 13716477; }; + lactose = { + name = "lactose"; + email = "lactose@allthingslinux.com"; + github = "juuyokka"; + githubId = 15185244; + }; lafrenierejm = { email = "joseph@lafreniere.xyz"; github = "lafrenierejm"; diff --git a/pkgs/by-name/xc/xcursor-pro/package.nix b/pkgs/by-name/xc/xcursor-pro/package.nix new file mode 100644 index 0000000000000..b14879d067ac4 --- /dev/null +++ b/pkgs/by-name/xc/xcursor-pro/package.nix @@ -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 = "."; + + 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 + ]; + }; +}) diff --git a/pkgs/by-name/xc/xcursor-pro/sources.nix b/pkgs/by-name/xc/xcursor-pro/sources.nix new file mode 100644 index 0000000000000..b49556869467f --- /dev/null +++ b/pkgs/by-name/xc/xcursor-pro/sources.nix @@ -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 diff --git a/pkgs/by-name/xc/xcursor-pro/update.sh b/pkgs/by-name/xc/xcursor-pro/update.sh new file mode 100755 index 0000000000000..5b720f4ffc9a2 --- /dev/null +++ b/pkgs/by-name/xc/xcursor-pro/update.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash -p nix-prefetch jq + +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"