Skip to content

Instantly share code, notes, and snippets.

@Lillecarl
Last active June 12, 2024 20:13
Show Gist options
  • Save Lillecarl/269235a48a596f86fde61e783e9de351 to your computer and use it in GitHub Desktop.
Save Lillecarl/269235a48a596f86fde61e783e9de351 to your computer and use it in GitHub Desktop.

broken HM line

This could then be changed to cfg.package.meta.themeInfo.themeDir

Note that outPath.txt shows a symlink settings the corrent name either way, that's because i rewrote the catppuccin-cursors package This is how it looks in my $HOME atm:

~/C/c/home-manager [ master][$⇕][🐚fish]
[22:02:47]❯ ls -lah ~/.icons/
d0755 lillecarl users  56 B  Wed Jun 12 19:24:48 2024  .
d0700 lillecarl users 2.0 KB Wed Jun 12 19:24:50 2024  ..
d0755 lillecarl users  22 B  Wed Jun 12 19:24:48 2024  default
l0777 lillecarl users  91 B  Wed Jun 12 19:24:48 2024  Catppuccin-Mocha-Blue ⇒ /nix/store/ba8vfkb2h5k08laj1b9669n96nkpf22a-home-manager-files/.icons/Catppuccin-Mocha-Blue

(The symlink doesn't exist)

From 8e9a2719e33aa76bb14cfe13b7db6a0ea69d9960 Mon Sep 17 00:00:00 2001
From: Carl Hjerpe <git@hjerpe.xyz>
Date: Wed, 12 Jun 2024 22:11:45 +0200
Subject: [PATCH] Just(xD) list flavors and accents
---
justfile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/justfile b/justfile
index 75c9c4a..caf6d8b 100644
--- a/justfile
+++ b/justfile
@@ -1,8 +1,15 @@
_default:
@just --list
+flavors := "latte frappe macchiato mocha"
accents := "blue dark flamingo green lavender light maroon mauve peach pink red rosewater sapphire sky teal yellow"
+flavors:
+ @echo {{flavors}}
+
+accents:
+ @echo {{accents}}
+
# Remove all files in the ".pngs/", ".hl/", "./dist" and "./releases" directories
clean:
rm -rf pngs/ hl/ dist/ releases/
--
2.44.1
{ lib
, stdenvNoCC
, fetchFromGitHub
, inkscape
, just
, xcursorgen
}:
let
src1 = fetchFromGitHub {
owner = "catppuccin";
repo = "cursors";
rev = "v${version}";
hash = "sha256-aQfbziN5z62LlgVq4CNMXVMmTrzChFgWUMAmO/2/z3Y=";
};
src = /home/lillecarl/Code/carl/cursors;
capitalizeFirst = str:
let
list = lib.stringToCharacters str;
first = lib.head list;
upper = lib.toUpper first;
noPrefix = lib.removePrefix first str;
out = lib.concatStrings [ upper noPrefix ];
in
out;
cursors-list = stdenvNoCC.mkDerivation {
pname = "catppuccin-cursors-info";
inherit version src;
buildPhase = "";
nativeBuildInputs = [ just ];
installPhase = ''
mkdir $out
just flavors > $out/flavors
just accents > $out/accents
'';
};
cursorPackage = { flavor, accent }:
let
variant = "${flavor}-${accent}";
capitalizedFlavor = capitalizeFirst flavor;
capitalizedAccent = capitalizeFirst accent;
in
stdenvNoCC.mkDerivation
{
pname = "catppuccin-cursors-${variant}";
inherit version;
inherit (cursors-list) src;
nativeBuildInputs = [ just inkscape xcursorgen ];
#outputs = variants ++ [ "out" ]; # dummy "out" output to prevent breakage
#outputsToInstall = [ ];
buildPhase = ''
runHook preBuild
patchShebangs .
just build ${flavor} ${accent}
runHook postBuild
'';
installPhase = ''
runHook preInstall
local iconsDir="$out"/share/icons
local distDir="catppuccin-${variant}-cursors"
mkdir -p "$iconsDir"
mv "dist/$distDir" "$iconsDir"
ln -s "$iconsDir/$distDir" "$iconsDir/Catppuccin-${capitalizedFlavor}-${capitalizedAccent}"
runHook postInstall
'';
meta = {
description = "Catppuccin cursor theme based on Volantes";
homepage = "https://github.com/catppuccin/cursors";
license = lib.licenses.gpl2;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ dixslyf ];
themeInfo = {
themeName = "Catppuccin-${capitalizedFlavor}-${capitalizedAccent}";
themeDir = "catppuccin-${variant}-cursors";
};
};
};
dimensions = {
flavors = lib.pipe (builtins.readFile "${cursors-list}/flavors") [ (x: lib.strings.removeSuffix "\n" x) (lib.splitString " ") ];
accents = lib.pipe (builtins.readFile "${cursors-list}/accents") [ (x: lib.strings.removeSuffix "\n" x) (lib.splitString " ") ];
};
version = "0.2.1";
in
lib.pipe dimensions [
(x: lib.mapCartesianProduct ({ flavors, accents }: { inherit flavors accents; }) x)
(x: map
(variant: {
name = "${variant.flavors}-${variant.accents}";
value = (cursorPackage { flavor = variant.flavors; accent = variant.accents; });
})
x
)
(x: lib.listToAttrs x)
]
~/C/nixos [ master][$!+?⇡][ v3.11.9][ /][🐚fish]
[21:59:03]❯ ls -lah /nix/store/qhpwz23lddw661nkkzb25cf933j97329-catppuccin-cursors-mocha-blue-0.2.1/share/icons/
d0555 root root 100 B Thu Jan 1 01:00:01 1970  .
d0555 root root 10 B Thu Jan 1 01:00:01 1970  ..
l0777 root root 29 B Thu Jan 1 01:00:01 1970  Catppuccin-Mocha-Blue ⇒ catppuccin-mocha-blue-cursors
d0555 root root 64 B Thu Jan 1 01:00:01 1970  catppuccin-mocha-blue-cursors
nix-repl> :p pkgs.catppuccin-cursors2.mocha-blue.meta.themeInfo
{
themeDir = "catppuccin-mocha-blue-cursors";
themeName = "Catppuccin-Mocha-Blue";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment