-
Notifications
You must be signed in to change notification settings - Fork 48
/
default.nix
94 lines (76 loc) · 2.43 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# stolen from https://github.com/diniamo/niqspkgs/blob/544c3b2c69fd1b5ab3407e7b35c76060801a8bcf/pkgs/bibata-hyprcursor/default.nix
{
lib,
stdenvNoCC,
fetchFromGitHub,
python3,
python3Packages,
hyprcursor,
variant ? "modern",
baseColor ? "#000000",
outlineColor ? "#FFFFFF",
watchBackgroundColor ? "#000000",
colorName ? "classic",
}: let
capitalize = str: let
capital_letter = builtins.substring 0 1 str;
non_capital = lib.removePrefix capital_letter str;
in
lib.toUpper capital_letter + non_capital;
themeName = "Bibata-${capitalize variant}-${capitalize colorName}-Hyprcursor";
in
assert builtins.elem variant ["modern" "modern-right" "original" "original-right"];
stdenvNoCC.mkDerivation (final: {
pname = "bibata-hyprcursor";
version = "v2.0.7";
src = fetchFromGitHub {
owner = "ful1e5";
repo = "Bibata_Cursor";
rev = final.version;
hash = "sha256-kIKidw1vditpuxO1gVuZeUPdWBzkiksO/q2R/+DUdEc=";
};
nativeBuildInputs = [
python3
python3Packages.tomli
python3Packages.tomli-w
hyprcursor
];
phases = ["unpackPhase" "configurePhase" "buildPhase" "installPhase"];
unpackPhase = ''
runHook preUnpack
cp $src/configs/${
if lib.hasSuffix "right" variant
then "right"
else "normal"
}/x.build.toml config.toml
mkdir cursors
for cursor in $src/svg/${variant}/*; do
cp -r $src/svg/${variant}/$(readlink $cursor) cursors
done
chmod -R u+w .
runHook postUnpack
'';
configurePhase = ''
runHook preConfigure
cat << EOF > manifest.hl
name = ${themeName}
description = The Bibata Cursor theme packaged for hyprcursor.
version = ${final.version}
cursors_directory = cursors
EOF
find cursors -type f -name '*.svg' | xargs sed -i -e 's/#00FF00/${baseColor}/g' -e 's/#0000FF/${outlineColor}/g' -e 's/#FF0000/${watchBackgroundColor}/g'
python ${./configure.py} config.toml cursors
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
hyprcursor-util --create . --output .
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/share/icons
cp -r theme_${themeName} $out/share/icons/${themeName}
runHook postInstall
'';
})