{ description = "Moosync is a customizable desktop music player with a clean interface."; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; outputs = { self, nixpkgs, }: let system = "x86_64-linux"; pkgs = nixpkgs.legacyPackages.${system}; name = "moosync"; version = "10.3.0"; src = pkgs.fetchurl { url = "https://github.com/Moosync/Moosync/releases/download/v${version}/Moosync-${version}-linux-x86_64.AppImage"; sha256 = "sha256-Mr8dTpjHs+1S3kOKZ2VGBQuY8z/8+sCNEIyp9FTc7iw="; }; desktopItem = pkgs.makeDesktopItem { inherit name; exec = name; desktopName = "Moosync"; terminal = false; icon = name; startupWMClass = "Moosync"; comment = "Moosync is a customizable desktop music player with a clean interface"; mimeTypes = ["x-scheme-handler/moosync"]; categories = ["Audio"]; extraConfig = {X-AppImage-Version = version;}; }; in { packages.${system} = { default = pkgs.appimageTools.wrapType2 { inherit name src; extraInstallCommands = let contents = pkgs.appimageTools.extract { inherit name src; }; in '' # Install .desktop file install -m 444 ${desktopItem}/share/applications/${name}.desktop -Dt $out/share/applications # Install icons for file in $(find ${contents}/usr/share/icons -type f); do directory=$(dirname ''${file#${contents}/usr}) install -m 444 $file -D $out/$directory/${name}.png done ''; }; }; apps.${system} = { dev = { program = "${pkgs.writeShellScript "download-appimage" '' ${pkgs.curl}/bin/curl ${src.url} -C - -Lo ${name}.AppImage ''}"; type = "app"; }; }; devShells.${system} = { default = pkgs.mkShellNoCC { packages = with pkgs; [ appimage-run file ]; shellHook = '' ${self.apps.${system}.dev.program} ''; }; }; }; }