add: desktop entry for google calendar
This commit is contained in:
parent
8c739b17f1
commit
3a0bd5f83a
2 changed files with 66 additions and 47 deletions
|
|
@ -1,52 +1,51 @@
|
|||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
name,
|
||||
url,
|
||||
sha256,
|
||||
}:
|
||||
{
|
||||
pkgs,
|
||||
imagemagick,
|
||||
file,
|
||||
stdenvNoCC,
|
||||
...
|
||||
}:
|
||||
let
|
||||
makeIconPkg =
|
||||
{
|
||||
name,
|
||||
url,
|
||||
sha256,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
inherit name;
|
||||
pname = name;
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
inherit url sha256;
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
imagemagick
|
||||
file
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/share/icons/hicolor/256x256/apps
|
||||
mkdir -p $out/share/icons/hicolor/scalable/apps
|
||||
|
||||
fileType=$(file -b --mime-type $src)
|
||||
if [ "$fileType" = "image/png" ]; then
|
||||
echo "Processing PNG image..."
|
||||
magick $src -resize 256x256 $out/share/icons/hicolor/256x256/apps/${name}.png
|
||||
elif [ "$fileType" = "image/svg+xml" ]; then
|
||||
echo "Processing SVG image..."
|
||||
cp $src $out/share/icons/hicolor/scalable/apps/${name}.svg
|
||||
else
|
||||
echo "Unsupported image type: $fileType"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
pathsToLink = [
|
||||
"/share/icons"
|
||||
];
|
||||
};
|
||||
appName = name;
|
||||
in
|
||||
makeIconPkg
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "${appName}-icon";
|
||||
name = pname;
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
inherit url sha256;
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
imagemagick
|
||||
file
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
mkdir -p $out/share/icons/hicolor/256x256/apps
|
||||
mkdir -p $out/share/icons/hicolor/scalable/apps
|
||||
|
||||
fileType=$(file -b --mime-type $src)
|
||||
if [ "$fileType" = "image/png" ]; then
|
||||
echo "Processing PNG image..."
|
||||
magick $src -resize 256x256 $out/share/icons/hicolor/256x256/apps/${appName}.png
|
||||
elif [ "$fileType" = "image/svg+xml" ]; then
|
||||
echo "Processing SVG image..."
|
||||
cp $src $out/share/icons/hicolor/scalable/apps/${appName}.svg
|
||||
else
|
||||
echo "Unsupported image type: $fileType"
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
pathsToLink = [
|
||||
"/share/icons"
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue