From 044bcc975b24bf839a82d615c9ef69b0f52a724a Mon Sep 17 00:00:00 2001 From: Kristian Krsnik Date: Thu, 25 Jan 2024 18:30:18 +0100 Subject: [PATCH] used embeded .desktop file and icons --- flake.nix | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/flake.nix b/flake.nix index fc00af1..90ee305 100644 --- a/flake.nix +++ b/flake.nix @@ -15,31 +15,28 @@ name = "starc"; version = "0.6.4"; - appImage = pkgs.fetchurl { + src = pkgs.fetchurl { url = "https://github.com/story-apps/starc/releases/download/v${version}/starc-setup.AppImage"; sha256 = "sha256-KLawvuLyqd7aPidH3ghr7mLl9NFQ7nduhnxAq0RpToQ="; }; in { packages.${system} = { default = pkgs.appimageTools.wrapType2 { - inherit name; - - src = appImage; + inherit name src; extraInstallCommands = let contents = pkgs.appimageTools.extract { - src = appImage; - pname = name; - inherit version; + inherit name src; }; in '' # Install .desktop file - mkdir -p $out/share/applications - cp ${contents}/${name}.desktop $out/share/applications + install -m 444 ${contents}/${name}.desktop -Dt $out/share/applications # Install icons - mkdir -p $out/share - cp -r ${contents}/share/icons $out/share + for file in $(find ${contents}/share/icons -type f); do + directory=$(dirname ''${file#${contents}}) + install -m 444 $file -D $out/$directory/${name}.png + done ''; }; }; @@ -47,7 +44,7 @@ apps.${system} = { dev = { program = "${pkgs.writeShellScript "download-appimage" '' - ${pkgs.curl}/bin/curl ${appImage.url} -Lo ${name}.AppImage + ${pkgs.curl}/bin/curl ${src.url} -Lo ${name}.AppImage ''}"; type = "app"; };