added icons and .desktop file

This commit is contained in:
Kristian Krsnik 2024-02-01 17:05:45 +01:00
parent e14dcbf39c
commit 737a1e4c72
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85

View File

@ -13,32 +13,54 @@
}: let }: let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
name = "scannedImageExtractor";
in { in {
packages.${system} = let packages.${system} = {
name = "scannedImageExtractor"; default = let
in { desktopItem = pkgs.makeDesktopItem {
default = pkgs.gccStdenv.mkDerivation { inherit name;
inherit name;
src = ./.;
nativeBuildInputs = with pkgs; [ exec = name;
cmake desktopName = "Scanned Image Extractor";
opencv2 terminal = false;
liblbfgs icon = name;
qt5.full mimeTypes = ["x-content/image-dcf"];
libsForQt5.qt5.wrapQtAppsHook categories = ["Graphics" "Photography" "GNOME" "KDE"];
]; };
in
pkgs.gccStdenv.mkDerivation {
inherit name;
src = ./.;
dontUseCmakeConfigure = true; nativeBuildInputs = with pkgs; [
buildPhase = '' cmake
cmake scannerExtract -DCMAKE_BUILD_TYPE=release -DOPENCV2=1 opencv2
make liblbfgs
''; qt5.full
libsForQt5.qt5.wrapQtAppsHook
];
installPhase = '' configurePhase = ''
install -m 555 ${name} -Dt $out/bin cmake scannerExtract -DCMAKE_BUILD_TYPE=release -DOPENCV2=1
''; '';
};
buildPhase = ''
make
'';
installPhase = ''
install -m 555 ${name} -Dt $out/bin
# Install .desktop file
install -m 444 ${desktopItem}/share/applications/${name}.desktop -Dt $out/share/applications
# Install icons
for dimension in 128 256; do
install -m 444 $src/scannerExtract/ico/${name}''${dimension}x''${dimension}.png -D $out/share/icons/''${dimension}x''${dimension}/apps/${name}.png
done
'';
};
appImage = let appImage = let
src = nix-appimage.bundlers.${system}.default self.packages.${system}.default; src = nix-appimage.bundlers.${system}.default self.packages.${system}.default;
@ -55,6 +77,15 @@
}; };
}; };
apps.${system} = {
appImage = {
program = "${pkgs.writeShellScript "scannedImageExtractor" ''
${pkgs.appimage-run}/bin/appimage-run ${self.packages.${system}.appImage}/${name}.AppImage
''}";
type = "app";
};
};
devShells = { devShells = {
default = pkgs.mkShellNoCC { default = pkgs.mkShellNoCC {
packages = with pkgs; [ packages = with pkgs; [