-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathpackage.nix
80 lines (67 loc) · 2.15 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{ stdenv
, lib
, fetchurl
, appimageTools
, makeWrapper
, electron_30
, electronPackage ? electron_30
, asar
}:
let
electron = electronPackage;
in
stdenv.mkDerivation rec {
pname = "catalyst3";
version = "3.8.0";
src = fetchurl {
url = "https://github.com/CatalystDevOrg/Catalyst/releases/download/v${version}/catalyst-${version}.AppImage";
hash = "sha256-wMqsj0G3AB5YBAUufGeq4+hsJpjPojRzM8lnyr4RPNk=";
name = "${pname}-${version}.AppImage";
};
buildInputs = [
asar
];
appimageContents = appimageTools.extractType2 {
name = "${pname}-${version}";
inherit src;
};
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/${pname} $out/share/applications
mkdir -p $out/share/${pname}/resources/
cp -a ${appimageContents}/locales $out/share/${pname}
cp -a ${appimageContents}/catalyst.desktop $out/share/applications/${pname}.desktop
cp -a ${appimageContents}/usr/share/icons $out/share
asar extract ${appimageContents}/resources/app.asar resources/
rm -rf resources/.github
rm -rf resources/.vscode
rm -rf resources/.eslintrc.json
rm -rf resources/.gitignore
rm -rf resources/.pnpm-debug.log
rm -rf resources/contributing.md
rm -rf resources/pnpm-lock.yaml
rm -rf resources/README.md
rm -rf resources/tailwind.config.js
rm -rf resources/CODE_OF_CONDUCT.md
sed -i 's/catalyst-default-distrib/catalyst-default-nix/g' resources/src/index.html
asar pack resources/ $out/share/${pname}/resources/app.asar
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=catalyst' 'Exec=${pname}'
runHook postInstall
'';
postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app.asar \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}"
'';
meta = with lib; {
description = "Catalyst web browser";
homepage = "https://github.com/CatalystDevOrg/Catalyst";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
};
}