From 06e4e90bca182b495430d341232e6d55df177ca6 Mon Sep 17 00:00:00 2001 From: Thibaut Smith Date: Sat, 5 Sep 2026 14:49:29 +0200 Subject: [PATCH] oklch-color-picker: add desktop entry --- .../by-name/ok/oklch-color-picker/package.nix | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ok/oklch-color-picker/package.nix b/pkgs/by-name/ok/oklch-color-picker/package.nix index dc0b2b31a9ab..32b7d8a616d4 100644 --- a/pkgs/by-name/ok/oklch-color-picker/package.nix +++ b/pkgs/by-name/ok/oklch-color-picker/package.nix @@ -9,6 +9,8 @@ libxkbcommon, libGL, stdenv, + makeDesktopItem, + copyDesktopItems, }: rustPlatform.buildRustPackage (finalAttrs: { @@ -24,7 +26,10 @@ rustPlatform.buildRustPackage (finalAttrs: { cargoHash = "sha256-FB8zvWhO+ZbzWjkQCnf3ghgM+IL4px7QNO4dLPcczec="; - nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]; + nativeBuildInputs = [ + copyDesktopItems + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ]; runtimeDependencies = [ libGL @@ -38,6 +43,24 @@ rustPlatform.buildRustPackage (finalAttrs: { doInstallCheck = true; passthru.updateScript = nix-update-script { }; + postInstall = '' + install -Dm444 assets/icon.png $out/share/icons/hicolor/512x512/apps/${finalAttrs.meta.mainProgram}.png + ''; + + desktopItems = [ + (makeDesktopItem { + name = finalAttrs.meta.mainProgram; + exec = finalAttrs.meta.mainProgram; + icon = finalAttrs.meta.mainProgram; + desktopName = "OKLCH Color Picker"; + genericName = "Color Picker"; + comment = finalAttrs.meta.description; + categories = [ + "Graphics" + ]; + }) + ]; + meta = { description = "Color picker for Oklch"; longDescription = '' @@ -46,6 +69,7 @@ rustPlatform.buildRustPackage (finalAttrs: { ''; homepage = "https://github.com/eero-lehtinen/oklch-color-picker"; changelog = "https://github.com/eero-lehtinen/oklch-color-picker/releases/tag/${finalAttrs.version}"; + mainProgram = "oklch-color-picker"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ videl ]; };