From 7a205c41203a9b9ec33e97601fc7bd351a9e1017 Mon Sep 17 00:00:00 2001 From: Sebastian Wendel Date: Sun, 15 Oct 2023 15:26:37 +0200 Subject: [PATCH] updated nix flake and package wrap --- flake.nix | 7 ------- pkgs/amlite/default.nix | 44 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index ec63cb5..33a2a96 100644 --- a/flake.nix +++ b/flake.nix @@ -63,12 +63,5 @@ amlite = self.pkgs.${system}.callPackage ./pkgs/amlite inputs; default = self.packages.${system}.amlite; }; - - apps = { - amlite = { - type = "app"; - program = "${self.packages.${system}.amlite}/bin/AmLite"; - }; - }; }); } diff --git a/pkgs/amlite/default.nix b/pkgs/amlite/default.nix index 9a0a9a4..21bdeb2 100644 --- a/pkgs/amlite/default.nix +++ b/pkgs/amlite/default.nix @@ -2,6 +2,17 @@ fetchurl, lib, stdenv, + autoPatchelfHook, + glib, + glibcLocales, + libxcb, + freetype, + libGL, + libXrender, + libX11, + fontconfig, + qt5, + makeDesktopItem, ... }: stdenv.mkDerivation rec { @@ -13,15 +24,32 @@ stdenv.mkDerivation rec { sha256 = "sha256-GyA3ogtpsNA/pTIa21ha9P1YtNE0reRDTAI7VOcdxnY="; }; + nativeBuildInputs = [ + autoPatchelfHook + glib + glibcLocales + libxcb + freetype + libGL + libXrender + libX11 + fontconfig + qt5.wrapQtAppsHook + ]; + # FIX: "unpacker appears to have produced no directories" sourceRoot = "."; postUnpack = '' - sed -n -e '1,/^exit 0$/!p' $sourceRoot/AmScopeAmLite.x64.sh > $sourceRoot/AmLite.tgz - cd $sourceRoot/ + cd $sourceRoot + sed -n -e '1,/^exit 0$/!p' AmScopeAmLite.x64.sh > AmLite.tgz tar -xzf AmLite.tgz ''; + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + installPhase = '' runHook preInstall @@ -37,6 +65,18 @@ stdenv.mkDerivation rec { runHook postInstall ''; + desktopItems = [ + (makeDesktopItem { + name = pname; + exec = "AmLite"; + icon = "AmLite"; + desktopName = meta.description; + genericName = meta.description; + comment = meta.description; + categories = ["Graphics" "Science" "Education"]; + }) + ]; + meta = with lib; { description = "AmScope AmLite"; homepage = "https://amscope.com/";