diff --git a/pkgs/os-specific/darwin/openwith/default.nix b/pkgs/os-specific/darwin/openwith/default.nix new file mode 100644 index 000000000000..37440659d7fd --- /dev/null +++ b/pkgs/os-specific/darwin/openwith/default.nix @@ -0,0 +1,36 @@ +{ lib, stdenv, fetchFromGitHub, swift, AppKit, Foundation, UniformTypeIdentifiers }: + +let + arch = if stdenv.isAarch64 then "arm64" else "x86_64"; +in +stdenv.mkDerivation rec { + pname = "openwith"; + version = "unstable-2022-10-28"; + + src = fetchFromGitHub { + owner = "jdek"; + repo = "openwith"; + rev = "a8a99ba0d1cabee7cb470994a1e2507385c30b6e"; + hash = "sha256-lysleg3qM2MndXeKjNk+Y9Tkk40urXA2ZdxY5KZNANo="; + }; + + nativeBuildInputs = [ swift ]; + + buildInputs = [ AppKit Foundation UniformTypeIdentifiers ]; + + makeFlags = [ "openwith_${arch}" ]; + + installPhase = '' + runHook preInstall + install openwith_${arch} -D $out/bin/openwith + runHook postInstall + ''; + + meta = with lib; { + description = "Utility to specify which application bundle should open specific file extensions"; + homepage = "https://github.com/jdek/openwith"; + license = licenses.unlicense; + maintainers = with maintainers; [ zowoq ]; + platforms = [ "aarch64-darwin" "x86_64-darwin" ]; + }; +} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index cf00c3da93cf..b067f5cbbc1e 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -170,6 +170,10 @@ impure-cmds // appleSourcePackages // chooseLibs // { opencflite = callPackage ../os-specific/darwin/opencflite { }; + openwith = pkgs.darwin.apple_sdk_11_0.callPackage ../os-specific/darwin/openwith { + inherit (apple_sdk_11_0.frameworks) AppKit Foundation UniformTypeIdentifiers; + }; + stubs = pkgs.callPackages ../os-specific/darwin/stubs { }; trash = callPackage ../os-specific/darwin/trash { };