@@ -0,0 +1,44 @@
1+{ lib
2+, stdenv
3+, fetchurl
4+, libarchive
5+, p7zip
6+}:
7+
8+stdenv.mkDerivation rec {
9+ pname = "mas";
10+ version = "1.8.1";
11+
12+ src = fetchurl {
13+ url = "https://github.com/mas-cli/mas/releases/download/v${version}/mas.pkg";
14+ sha256 = "W/wgg+ETeJPoZ7MoVGH2uJzQiZMLIy3n1JYKUloc3ZU=";
15+ };
16+
17+ nativeBuildInputs = [ libarchive p7zip ];
18+
19+ unpackPhase = ''
20+ 7z x $src
21+ bsdtar -xf Payload~
22+ '';
23+
24+ doBuild = false;
25+
26+ installPhase = ''
27+ mkdir -p $out
28+ cp -r ./bin $out
29+ cp -r ./Frameworks $out
30+ '';
31+
32+ postFixup = ''
33+ install_name_tool -change @rpath/MasKit.framework/Versions/A/MasKit $out/Frameworks/MasKit.framework/Versions/A/MasKit $out/bin/mas
34+ install_name_tool -change @rpath/Commandant.framework/Commandant $out/Frameworks/MasKit.framework/Versions/A/Frameworks/Commandant.framework/Versions/A/Commandant $out/bin/mas
35+ '';
36+
37+ meta = with lib; {
38+ description = "Mac App Store command line interface";
39+ homepage = "https://github.com/mas-cli/mas";
40+ license = licenses.mit;
41+ maintainers = with maintainers; [ zachcoyle ];
42+ platforms = platforms.darwin;
43+ };
44+}