From 5be87108880900c85f3ce454ea5ebb40c4fcc1f7 Mon Sep 17 00:00:00 2001 From: D3vil0p3r Date: Sun, 30 Jun 2024 03:25:07 +0200 Subject: [PATCH] tokyonight-gtk-theme: unstable-2023-05-31 -> 0-unstable-2024-06-27 --- .../to/tokyonight-gtk-theme/package.nix | 59 ++++++++++++++ .../themes/tokyonight-gtk-theme/default.nix | 38 --------- .../themes/tokyonight-gtk-theme/generic.nix | 77 ------------------- .../themes/tokyonight-gtk-theme/variants.json | 18 ----- pkgs/top-level/all-packages.nix | 4 - 5 files changed, 59 insertions(+), 137 deletions(-) create mode 100644 pkgs/by-name/to/tokyonight-gtk-theme/package.nix delete mode 100644 pkgs/data/themes/tokyonight-gtk-theme/default.nix delete mode 100644 pkgs/data/themes/tokyonight-gtk-theme/generic.nix delete mode 100644 pkgs/data/themes/tokyonight-gtk-theme/variants.json diff --git a/pkgs/by-name/to/tokyonight-gtk-theme/package.nix b/pkgs/by-name/to/tokyonight-gtk-theme/package.nix new file mode 100644 index 000000000000..70e8d9d37672 --- /dev/null +++ b/pkgs/by-name/to/tokyonight-gtk-theme/package.nix @@ -0,0 +1,59 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + gnome, + sassc, + gnome-themes-extra, + gtk-engine-murrine, + colorVariants ? [] # default: install all icons +}: + +let + pname = "tokyonight-gtk-theme"; + colorVariantList = [ + "dark" + "light" + ]; + +in +lib.checkListOfEnum "${pname}: colorVariants" colorVariantList colorVariants + +stdenvNoCC.mkDerivation { + inherit pname; + version = "0-unstable-2024-06-27"; + + src = fetchFromGitHub { + owner = "Fausto-Korpsvart"; + repo = "Tokyonight-GTK-Theme"; + rev = "2f566d89856516bef988df3cc32261f752299886"; + hash = "sha256-oKqLb66N4swHfhjUZJIGryE0D9MkuLdKFQa6j3TFmOg="; + }; + + propagatedUserEnvPkgs = [ gtk-engine-murrine ]; + + nativeBuildInputs = [ gnome.gnome-shell sassc ]; + buildInputs = [ gnome-themes-extra ]; + + dontBuild = true; + + postPatch = '' + patchShebangs themes/install.sh + ''; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/themes + cd themes + ./install.sh -n Tokyonight -c ${lib.concatStringsSep " " (if colorVariants != [] then colorVariants else colorVariantList)} --tweaks macos -d "$out/share/themes" + runHook postInstall + ''; + + meta = with lib; { + description = "GTK theme based on the Tokyo Night colour palette"; + homepage = "https://github.com/Fausto-Korpsvart/Tokyonight-GTK-Theme"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ garaiza-93 Madouura d3vil0p3r ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/data/themes/tokyonight-gtk-theme/default.nix b/pkgs/data/themes/tokyonight-gtk-theme/default.nix deleted file mode 100644 index b56b0aadd3ed..000000000000 --- a/pkgs/data/themes/tokyonight-gtk-theme/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib -, callPackage -, runCommand -, gtk-engine-murrine -, gnome-themes-extra -}: - -let - prefix = "tokyonight-gtk-theme"; - - packages = lib.mapAttrs' (type: content: { - name = type; - - value = lib.mapAttrs' (variantName: variant: { - name = variantName; - value = callPackage ./generic.nix { inherit prefix type variantName variant; }; - }) content; - }) (lib.importJSON ./variants.json); -in packages // { - # Not using `symlinkJoin` because it's massively inefficient in this case - full = runCommand "${prefix}_full" { - preferLocalBuild = true; - - propagatedUserEnvPkgs = [ - gtk-engine-murrine - gnome-themes-extra - ]; - } '' - mkdir -p $out/share/{icons,themes,${prefix}} - - ${lib.concatStrings (lib.forEach (lib.attrValues (lib.attrsets.mergeAttrsList (lib.attrValues packages))) (variant: - '' - ln -s ${variant}/share/${variant.ptype}/Tokyonight-${variant.pvariant} $out/share/${variant.ptype}/Tokyonight-${variant.pvariant} - ln -s ${variant}/share/${prefix}/LICENSE $out/share/${prefix}/LICENSE 2>/dev/null || true - '' - ))} - ''; -} diff --git a/pkgs/data/themes/tokyonight-gtk-theme/generic.nix b/pkgs/data/themes/tokyonight-gtk-theme/generic.nix deleted file mode 100644 index 1adbf674a586..000000000000 --- a/pkgs/data/themes/tokyonight-gtk-theme/generic.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ lib -, stdenvNoCC -, fetchFromGitHub -, writeScript -, gtk-engine-murrine -, gnome-themes-extra -, prefix ? "" -, type ? "" -, variantName ? "" -, variant ? "" -}: - -stdenvNoCC.mkDerivation (finalAttrs: { - pname = "${prefix}_${type}-${variantName}"; - version = "unstable-2023-05-31"; - - src = fetchFromGitHub { - owner = "Fausto-Korpsvart"; - repo = "Tokyo-Night-GTK-Theme"; - rev = "e9790345a6231cd6001f1356d578883fac52233a"; - hash = "sha256-Q9UnvmX+GpvqSmTwdjU4hsEsYhA887wPqs5pyqbIhmc="; - }; - - propagatedUserEnvPkgs = [ - gtk-engine-murrine - gnome-themes-extra - ]; - - dontPatch = true; - dontConfigure = true; - dontBuild = true; - dontFixup = true; - - installPhase = '' - runHook preInstall - - mkdir -p $out/share/{${type},${prefix}} - cp -a ${type}/Tokyonight-${variant} $out/share/${type} - cp -a LICENSE $out/share/${prefix} - - runHook postInstall - ''; - - passthru = { - updateScript = writeScript "update.sh" '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p curl common-updater-scripts tree jq - res="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \ - -sL "https://api.github.com/repos/${finalAttrs.src.owner}/${finalAttrs.src.repo}/commits/HEAD")" - - rev="$(echo $res | jq '.sha' --raw-output)" - version="unstable-$(echo $res | jq '.commit | .author | .date' --raw-output | sed 's/T.*$//')" - update-source-version ${prefix}-variants.${type}.${variantName} "$version" "$rev" --ignore-same-hash - - commonjq1='.[] .contents .[] | {(.name): .name} | walk(if type=="object" then with_entries(.key|=ascii_downcase) else . end)' - commonjq2='reduce inputs as $in (.; . + $in)' - commontree="-dJ -L 1 --noreport ${finalAttrs.src}" - - echo $(tree $commontree/icons | jq "$commonjq1" | jq "$commonjq2" | jq '{icons: .}') \ - $(tree $commontree/themes | jq "$commonjq1" | jq "$commonjq2" | jq '{themes: .}') | \ - jq 'reduce inputs as $in (.; . + $in)' | sed "s/[tT]okyonight-//g" > \ - "$(git rev-parse --show-toplevel)/pkgs/data/themes/${prefix}/variants.json" - ''; - - # For "full" in default.nix - ptype = type; - pvariant = variant; - }; - - meta = with lib; { - description = "GTK theme based on the Tokyo Night colour palette"; - homepage = "https://www.pling.com/p/1681315"; - license = licenses.gpl3Only; - platforms = platforms.unix; - maintainers = with maintainers; [ garaiza-93 Madouura ]; - }; -}) diff --git a/pkgs/data/themes/tokyonight-gtk-theme/variants.json b/pkgs/data/themes/tokyonight-gtk-theme/variants.json deleted file mode 100644 index 6489d9c649de..000000000000 --- a/pkgs/data/themes/tokyonight-gtk-theme/variants.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "icons": { - "dark": "Dark", - "dark-cyan": "Dark-Cyan", - "light": "Light", - "moon": "Moon" - }, - "themes": { - "dark-b": "Dark-B", - "dark-bl": "Dark-BL", - "dark-b-lb": "Dark-B-LB", - "dark-bl-lb": "Dark-BL-LB", - "storm-b": "Storm-B", - "storm-bl": "Storm-BL", - "storm-b-lb": "Storm-B-LB", - "storm-bl-lb": "Storm-BL-LB" - } -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a5020c42dfb9..976a59923102 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34656,10 +34656,6 @@ with pkgs; tofi = callPackage ../applications/misc/tofi { }; - tokyonight-gtk-theme = tokyonight-gtk-theme-variants.full; - - tokyonight-gtk-theme-variants = recurseIntoAttrs (callPackage ../data/themes/tokyonight-gtk-theme { }); - topydo = callPackage ../applications/misc/topydo { }; torrential = callPackage ../applications/networking/p2p/torrential { };