fend: add a desktop file

This commit is contained in:
Olli Helenius 2023-09-20 20:27:35 +03:00
parent a0a59a8131
commit 9740d7bb58
No known key found for this signature in database
GPG Key ID: 67235CC88F41DE3C

View File

@ -5,6 +5,8 @@
, darwin
, pandoc
, installShellFiles
, copyDesktopItems
, makeDesktopItem
}:
rustPlatform.buildRustPackage rec {
@ -20,7 +22,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-oAkZHx33YrwRUUIoooqpy72QCq0ZkAgBZ8W8XDe2fNE=";
nativeBuildInputs = [ pandoc installShellFiles ];
nativeBuildInputs = [ pandoc installShellFiles copyDesktopItems ];
buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
postBuild = ''
@ -38,6 +40,23 @@ rustPlatform.buildRustPackage rec {
[[ "$($out/bin/fend "1 km to m")" = "1000 m" ]]
'';
postInstall = ''
install -D -m 444 $src/icon/fend-icon-256.png $out/share/icons/hicolor/256x256/apps/fend.png
'';
desktopItems = [
(makeDesktopItem {
name = "fend";
desktopName = "fend";
genericName = "Calculator";
comment = "Arbitrary-precision unit-aware calculator";
icon = "fend";
exec = "fend";
terminal = true;
categories = [ "Utility" "Calculator" "ConsoleOnly" ];
})
];
meta = with lib; {
description = "Arbitrary-precision unit-aware calculator";
homepage = "https://github.com/printfn/fend";