From 1e336db1a9ef063af28344765ac4f7973715fb9e Mon Sep 17 00:00:00 2001 From: awkawb Date: Wed, 1 Jan 2025 15:22:49 -0500 Subject: [PATCH] package.nix: added desktop menu entry --- flake.nix | 38 +++++++++++++++++++------------------- package.nix | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index 96c62a5..f5e61eb 100644 --- a/flake.nix +++ b/flake.nix @@ -3,26 +3,26 @@ outputs = { self, nixpkgs, nix, }: - let - systems = [ "x86_64-linux" ]; - forEachSystem = nixpkgs.lib.genAttrs systems; + let + systems = [ "x86_64-linux" ]; + forEachSystem = nixpkgs.lib.genAttrs systems; - overlayList = [ self.overlays.default ]; + overlayList = [ self.overlays.default ]; - pkgsBySystem = forEachSystem ( - system: - import nixpkgs { - inherit system; - overlays = overlayList; - } - ); - in - rec { - overlays.default = final: prev: { invoiceninja-desktop = final.callPackage ./package.nix { }; }; + pkgsBySystem = forEachSystem ( + system: + import nixpkgs { + inherit system; + overlays = overlayList; + } + ); + in + rec { + overlays.default = final: prev: { invoiceninja-desktop = final.callPackage ./package.nix { }; }; - packages = forEachSystem (system: { - invoiceninja-desktop = pkgsBySystem.${system}.invoiceninja-desktop; - default = pkgsBySystem.${system}.invoiceninja-desktop; - }); - }; + packages = forEachSystem (system: { + invoiceninja-desktop = pkgsBySystem.${system}.invoiceninja-desktop; + default = pkgsBySystem.${system}.invoiceninja-desktop; + }); + }; } diff --git a/package.nix b/package.nix index cad3cc0..efeffa5 100644 --- a/package.nix +++ b/package.nix @@ -1,6 +1,26 @@ -{ lib, fetchFromGitHub, flutter319 }: +{ lib +, makeDesktopItem +, copyDesktopItems +, wrapGAppsHook3 +, fetchFromGitHub +, flutter319 +}: let + desktopFile = makeDesktopItem rec { + name = "Invoice Ninja"; + desktopName = name; + exec = "invoiceninja"; + icon = "invoiceninja"; + startupWMClass = "invoiceninja"; + categories = [ "Office" ]; + terminal = false; + extraConfig = { + X-MultipleArgs = "false"; + }; + }; + +in flutter319.buildFlutterApplication rec { version = "5.0.172"; src = fetchFromGitHub { @@ -10,9 +30,6 @@ let hash = "sha256-yYGGmF0XiixDi/OuLdlKwN685BUsxcIFzIqXkJi4KMs="; }; -in flutter319.buildFlutterApplication { - inherit version src; - pname = "invoice-ninja-desktop"; targetFlutterPlatform = "linux"; @@ -29,10 +46,22 @@ in flutter319.buildFlutterApplication { super_text_layout = "sha256-SGWTs2zHObYAC8J/LdtdmoDtI/EQZr0fJoYMpGcyGWE="; }; + nativeBuildInputs = [ + copyDesktopItems + wrapGAppsHook3 + ]; + postUnpack = '' mv $sourceRoot/lib/.env.dart.example $sourceRoot/lib/.env.dart ''; + postInstall = '' + mkdir -p $out/share/icons + mv $out/app/invoice-ninja-desktop/data/flutter_assets/assets/images/icon.png $out/share/icons/invoiceninja.png + ''; + + desktopItems = [ desktopFile ]; + meta = { description = "Invoice Ninja desktop client"; homepage = "https://github.com/invoiceninja/admin-portal";