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

Implement changes to track whether themes are outdated or not. #13

Merged
merged 5 commits into from
Nov 24, 2023
Merged
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
50 changes: 46 additions & 4 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
paths:
- 'pkgs/nvfetcher.toml'
repository_dispatch:
# repository_dispatch:
workflow_dispatch:

jobs:
Expand All @@ -22,6 +22,7 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
path: src

- name: Check free-disk-space (before clean)
run: df -h
Expand All @@ -42,18 +43,58 @@ jobs:
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}

- name: Check for manifest change
id: manifest
run: |
URL="https://api.github.com/repos/spicetify/spicetify-themes"
START=$(date -d 'yesterday' --utc --iso-8601=seconds)
END=$(date --utc --iso-8601=seconds)
LIST=$(curl -s "${URL}/commits?since=${START}&until=${END}" | jq -r '.[] | "\(.sha)"')
HEAD=$(echo "$LIST" | head -n 1)
TAIL=$(echo "$LIST" | tail -n 1)
FILES=$(curl -s "${URL}/compare/${TAIL}...${HEAD}" | jq -r '.files[].filename')
if [[ "$FILES" == *'manifest.json'* ]]; then
echo "check=true" >> "$GITHUB_OUTPUT"
else
echo "check=false" >> "$GITHUB_OUTPUT"
fi

- name: Download Manifest
uses: actions/checkout@v4
if: steps.manifest.outputs.check == 'true'
with:
repository: spicetify/spicetify-themes
path: themes

- name: Move Manifest
if: steps.manifest.outputs.check == 'true'
run: |
cp themes/manifest.json src/

- name: Update Manifest
uses: stefanzweifel/git-auto-commit-action@v4
if: steps.manifest.outputs.check == 'true'
with:
repository: src/
file_pattern: "manifest.json"
commit_message: "chore: Bump Manifest"

- name: Run nvfetcher
run: |
nix run github:berberman/nvfetcher -- -o pkgs/_sources -c pkgs/nvfetcher.toml
nix run github:berberman/nvfetcher -- -o src/pkgs/_sources -c src/pkgs/nvfetcher.toml

- name: Show flake metadata
run: nix flake metadata --impure
run: |
cd src/
nix flake metadata --impure

- name: Check free-disk-space (before nix build)
run: df -h

- name: Build nix packages
run: nix build .#checks.x86_64-linux.default --impure -v
run: |
cd src/
nix build .#checks.x86_64-linux.default --impure -v

- name: Check free-disk-space (after nix build)
run: df -h
Expand All @@ -62,5 +103,6 @@ jobs:
if: ${{ success() }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: src/
commit_message: "chore: Bump Spicetify Packages"
file_pattern: "pkgs/_sources/"
229 changes: 229 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
[
{
"name": "BurntSienna",
"description": "BurntSienna",
"preview": "BurntSienna/screenshot.png",
"readme": "BurntSienna/README.md",
"usercss": "BurntSienna/user.css",
"schemes": "BurntSienna/color.ini",
"authors": [
{
"name": "pjaspinski",
"url": "https://github.com/pjaspinski"
}
],
"tags": [
"latest"
]
},
{
"name": "Default",
"description": "Default",
"preview": "Default/ocean.png",
"readme": "Default/README.md",
"usercss": "Default/user.css",
"schemes": "Default/color.ini",
"authors": [
{
"name": "Blacksuan19",
"url": "https://github.com/Blacksuan19"
}
],
"tags": [
"latest"
]
},
{
"name": "Dreary",
"description": "Dreary",
"preview": "Dreary/deeper.png",
"readme": "Dreary/README.md",
"usercss": "Dreary/user.css",
"schemes": "Dreary/color.ini",
"authors": [
{
"name": "CharlieS1103",
"url": "https://github.com/CharlieS1103"
}
],
"tags": [
"outdated",
"v1.2.13"
]
},
{
"name": "Dribbblish",
"description": "Dribbblish",
"preview": "Dribbblish/base.png",
"readme": "Dribbblish/README.md",
"usercss": "Dribbblish/user.css",
"schemes": "Dribbblish/color.ini",
"include": [
"https://raw.githubusercontent.com/spicetify/spicetify-themes/master/Dribbblish/theme.js"
],
"authors": [
{
"name": "khanhas",
"url": "https://github.com/khanhas"
},
{
"name": "harbassan",
"url": "https://github.com/harbassan"
}
],
"tags": [
"latest"
]
},
{
"name": "Matte",
"description": "Has a neat color pallete and a much cleaner interface",
"preview": "Matte/screenshots/queue.png",
"readme": "Matte/README.md",
"usercss": "Matte/user.css",
"schemes": "Matte/color.ini",
"authors": [
{
"name": "darkthemer",
"url": "https://github.com/darkthemer"
}
],
"tags": [
"outdated",
"v1.2.22"
]
},
{
"name": "Onepunch",
"description": "Onepunch",
"preview": "Onepunch/screenshots/dark_home.png",
"readme": "Onepunch/README.md",
"usercss": "Onepunch/user.css",
"schemes": "Onepunch/color.ini",
"authors": [
{
"name": "okarin001",
"url": "https://github.com/okarin001"
}
],
"tags": [
"latest"
]
},
{
"name": "Sleek",
"description": "Sleek",
"preview": "Sleek/coral.png",
"readme": "Sleek/README.md",
"usercss": "Sleek/user.css",
"schemes": "Sleek/color.ini",
"authors": [
{
"name": "harbassan",
"url": "https://github.com/harbassan"
}
],
"tags": [
"latest"
]
},
{
"name": "text",
"description": "a spicetify theme that mimics the look of spotify-tui",
"preview": "text/screenshots/Gruvbox.png",
"readme": "text/README.md",
"usercss": "text/user.css",
"schemes": "text/color.ini",
"authors": [
{
"name": "darkthemer",
"url": "https://github.com/darkthemer"
}
],
"tags": [
"latest"
]
},
{
"name": "Turntable",
"description": "Turntable",
"preview": "Turntable/screenshots/turntable.png",
"readme": "Turntable/README.md",
"usercss": "Turntable/user.css",
"schemes": "Turntable/color.ini",
"include": [
"https://raw.githubusercontent.com/spicetify/spicetify-themes/master/Turntable/theme.js"
],
"authors": [
{
"name": "Grason Chan",
"url": "https://github.com/grasonchan"
}
],
"tags": [
"latest"
]
},
{
"name": "Ziro",
"description": "a smooth theme inspired by zorin os",
"preview": "https://raw.githubusercontent.com/schnensch0/ziro/main/preview/mockup.png",
"readme": "Ziro/README.md",
"usercss": "Ziro/user.css",
"schemes": "Ziro/color.ini",
"authors": [
{
"name": "schnensch0",
"url": "https://github.com/schnensch0"
}
],
"tags": [
"latest"
]
},
{
"name": "Flow",
"description": "Spicetify theme that has linear gradient effect and vertical playbar",
"preview": "https://raw.githubusercontent.com/spicetify/spicetify-themes/master/Flow/screenshots/pink.png",
"readme": "Flow/README.md",
"usercss": "Flow/user.css",
"schemes": "Flow/color.ini",
"authors": [
{
"name": "Ian Liao",
"url": "https://github.com/ian-Liaozy"
},
{
"name": "Victoria Zhang",
"url": "https://github.com/Ruixi-Zhang"
},
{
"name": "Yu Sung Lee",
"url": "https://github.com/yslDevelop"
},
{
"name": "Alex Casieri",
"url": "https://github.com/alexcasieri30"
}
],
"tags": [
"latest"
]
},
{
"name": "Blossom",
"description": "Blossom Theme, a simple theme.",
"preview": "https://user-images.githubusercontent.com/72624799/203471073-4a5e6cf0-a5dc-4ecc-9a12-56d5fc716ac4.png",
"readme": "Blossom/README.md",
"usercss": "Blossom/user.css",
"schemes": "Blossom/color.ini",
"authors": [
{
"name": "Robatortas", "url": "https://github.com/Robatortas"
}
],
"tags": [
"latest"
]
}
]
56 changes: 38 additions & 18 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,27 +127,47 @@ in {
xpui = lib.attrsets.recursiveUpdate cfg.xpui spiceLib.types.defaultXpui;
actualTheme = let
inherit (cfg) theme;
warnlist = ["Glaze"];

blacklist = ["catppuccin-"];
compareFunc = bad: lib.strings.hasPrefix bad theme.name;
blacklistCheck = lib.lists.any (compareFunc) blacklist;
warnlistCheck = lib.lists.any compareFunc warnlist;
blacklistCheck = lib.lists.any (entry: lib.strings.hasPrefix entry theme.name) blacklist;
blacklistMsg = let
scheme = lib.strings.removePrefix (lib.lists.findFirst compareFunc "" blacklist) theme.name;
in
lib.trivial.warn ''
Catppuccin has recently changed, moved from multiple theme packages into one, with accents defined
in colorScheme See: https://github.com/the-argus/spicetify-nix/issues/41 for more info
Change
theme = spicePkgs.themes.${theme.name};
to
theme = spicePkgs.themes.catppuccin;
colorScheme = ${scheme};
''
theme;

isOutdated = tag: strings.hasPrefix tag "outdated";
manifest = builtins.filter (entry: lists.any isOutdated entry.tags) (builtins.fromJSON (builtins.readFile ./manifest.json));
warnlist =
(builtins.map (entry: {
inherit (entry) name;
versions = builtins.filter (!isOutdated) entry.tags;
})
manifest) ++ [{name = "Glaze"; versions = ["1.2.6"];}];
warnlistCheck = lists.any (entry: entry == theme.name) warnlist;
# TODO: decide if we should warn or throw here. If we throw, if that should be higher up the stack.
blacklistMsg = let scheme = lib.strings.removePrefix (lib.lists.findFirst (compareFunc) "" blacklist) theme.name; in lib.trivial.warn ''
Catppuccin has recently changed, moved from multiple theme packages into one, with accents defined
in colorScheme See: https://github.com/the-argus/spicetify-nix/issues/41 for more info
Change
theme = spicePkgs.themes.${theme.name};
to
theme = spicePkgs.themes.catppuccin;
colorScheme = ${scheme};
'' theme;
warnlistMsg = lib.trivial.warn ''
${theme.name} has been deprecated, be forewarned that it might not work with current
versions of spotify.
'' theme;
warnlistMsg =
lib.trivial.warn ''
${theme.name} has been deprecated, be forewarned that it might not work with current
versions of spotify.
''
theme;
in
spiceLib.getTheme (if blacklistCheck then blacklistMsg else if warnlistCheck then warnlistMsg else theme);
spiceLib.getTheme (
if blacklistCheck
then blacklistMsg
else if warnlistCheck
then warnlistMsg
else theme
);

# take the list of extensions and turn strings into actual extensions
allExtensions = map spiceLib.getExtension (cfg.enabledExtensions
Expand Down
Loading