@@ -1,69 +1,158 @@
1−{stdenv, fetchhg, fetchurl, fetchzip, gtk, glib, pkgconfig, unzip, ncurses, zip}:
1+{ stdenv, fetchhg, fetchurl, fetchzip, gtk, glib, pkgconfig, unzip, ncurses, zip }:
22let
3− buildInputs = [
4− gtk glib pkgconfig unzip ncurses zip
5− ];
3+ # Textadept requires a whole bunch of external dependencies.
4+ # The build system expects to be able to download them with wget.
5+ # This expression gets Nix to fetch them instead.
6+
7+
68 cached_url = url: sha256: fetchurl {
79 inherit sha256 url;
810 };
9− get_url = url: sha256: ''
10− cp ${(cached_url url sha256)} $(basename ${(cached_url url sha256)} | sed -e 's@^[0-9a-z]\+-@@')
11− touch $(basename ${(cached_url url sha256)} | sed -e 's@^[0-9a-z]\+-@@')
11+
12+ get_url = url: sha256: let
13+ store_path = cached_url url sha256;
14+ in ''
15+ local_path=$(basename ${store_path} | sed -e 's@^[0-9a-z]\+-@@')
16+
17+ # Copy the file from the Nix store and remove the hash part.
18+ cp ${store_path} $local_path
19+
20+ # Update its access and modified times.
21+ touch $local_path
1222 '';
23+
1324 cached_url_zip = url: sha256: fetchzip {
1425 inherit sha256 url;
1526 };
16− get_url_zip = url: sha256: let zipdir = (cached_url_zip url sha256); in ''
17− ( d=$PWD; cd $TMPDIR; name=$(basename ${zipdir} .zip | sed -e 's/^[a-z0-9]*-//');
18− cp -r ${zipdir} $name; chmod u+rwX -R $name; zip -r $d/$name.zip $name )
19− touch $name
27+
28+ get_url_zip = url: sha256: let
29+ store_path = cached_url_zip url sha256;
30+ in ''
31+ (
32+ build_dir=$PWD
33+ cd $TMPDIR
34+
35+ local_path=$(basename ${store_path} .zip | sed -e 's/^[a-z0-9]*-//')
36+
37+ cp -r ${store_path} $local_path
38+ chmod u+rwX -R $local_path
39+ zip -r $build_dir/$local_path.zip $local_path
40+ touch $local_path
41+ )
2042 '';
43+
44+
45+ # These lists are taken from the Makefile.
46+ scintilla_tgz = "scintilla365.tgz";
47+ scinterm_zip = "scinterm_1.8.zip";
48+ scintillua_zip = "scintillua_3.6.5-1.zip";
49+ lua_tgz = "lua-5.3.2.tar.gz";
50+ lpeg_tgz = "lpeg-1.0.0.tar.gz";
51+ lfs_zip = "v_1_6_3.zip";
52+ luautf8_zip = "0.1.1.zip";
53+ lspawn_zip = "lspawn_1.5.zip";
54+ luajit_tgz = "LuaJIT-2.0.3.tar.gz";
55+ libluajit_tgz = "libluajit_2.0.3.x86_64.tgz";
56+ gtdialog_zip = "gtdialog_1.2.zip";
57+ cdk_tgz = "cdk-5.0-20150928.tgz";
58+ termkey_tgz = "libtermkey-0.17.tar.gz";
59+ bombay_zip = "bombay.zip";
60+
61+ scinterm_url = "http://foicica.com/scinterm/download/" + scinterm_zip;
62+ scintillua_url = "http://foicica.com/scintillua/download/" + scintillua_zip;
63+ gtdialog_url = "http://foicica.com/gtdialog/download/" + gtdialog_zip;
64+ lspawn_url = "http://foicica.com/lspawn/download/" + lspawn_zip;
65+
66+ scintilla_url = "http://prdownloads.sourceforge.net/scintilla/" + scintilla_tgz;
67+ lua_url = "http://www.lua.org/ftp/" + lua_tgz;
68+ lpeg_url = "http://www.inf.puc-rio.br/~roberto/lpeg/" + lpeg_tgz;
69+ lfs_url = "https://github.com/keplerproject/luafilesystem/archive/" + lfs_zip;
70+ luautf8_url = "https://github.com/starwing/luautf8/archive/" + luautf8_zip;
71+ luajit_url = "http://luajit.org/download/" + luajit_tgz;
72+ libluajit_url = "http://foicica.com/textadept/download/" + libluajit_tgz;
73+ cdk_url = "http://invisible-mirror.net/archives/cdk/" + cdk_tgz;
74+ bombay_url = "http://foicica.com/hg/bombay/archive/tip.zip";
75+ termkey_url = "http://www.leonerd.org.uk/code/libtermkey/" + termkey_tgz;
76+
77+
78+ get_scintilla = get_url scintilla_url "1s5zbkn5f3vs8gbnjlkfzw4b137y12m3c89lyc4pmvqvrvxgyalj";
79+ get_scinterm = get_url scinterm_url "02ax6cjpxylfz7iqp1cjmsl323in066a38yklmsyzdl3w7761nxi";
80+ get_scintillua = get_url scintillua_url "0s4q7a9mgvxh0msi18llkczhcgafaiizw9qm1p9w18r2a7wjq9wc";
81+ get_lua = get_url lua_url "13x6knpv5xsli0n2bib7g1nrga2iacy7qfy63i798dm94fxwfh67";
82+ get_lpeg = get_url lpeg_url "13mz18s359wlkwm9d9iqlyyrrwjc6iqfpa99ai0icam2b3khl68h";
83+ get_lfs = get_url_zip lfs_url "1hxcnqj53540ysyw8fzax7f09pl98b8f55s712gsglcdxp2g2pri";
84+ get_luautf8_zip = get_url_zip luautf8_url "1dgmxdk88njpic4d4sn2wzlni4b6sfqcsmh2hrraxivpqf9ps7f7";
85+ get_lspawn = get_url lspawn_url "09c6v9irblay2kv1n7i59pyj9g4xb43c6rfa7ba5m353lymcwwqi";
86+ get_luajit = get_url luajit_url "0ydxpqkmsn2c341j4r2v6r5r0ig3kbwv3i9jran3iv81s6r6rgjm";
87+ get_libluajit = get_url libluajit_url "1nhvcdjpqrhd5qbihdm3bxpw84irfvnw2vmfqnsy253ay3dxzrgy";
88+ get_gtdialog = get_url gtdialog_url "0nvcldyhj8abr8jny9pbyfjwg8qfp9f2h508vjmrvr5c5fqdbbm0";
89+ get_cdk = get_url cdk_url "0j74l874y33i26y5kjg3pf1vswyjif8k93pqhi0iqykpbxfsg382";
90+ get_bombay = get_url_zip bombay_url "05fnh1imxdb4sb076fzqywqszp31whdbkzmpkqxc8q2r1m5vj3hg"
91+ + "mv tip.zip bombay.zip\n";
92+ get_termkey = get_url termkey_url "12gkrv1ldwk945qbpprnyawh0jz7rmqh18fyndbxiajyxmj97538";
93+
94+
95+ get_deps = get_scintilla
96+ + get_scinterm
97+ + get_scintillua
98+ + get_lua
99+ + get_lpeg
100+ + get_lfs
101+ + get_luautf8_zip
102+ + get_lspawn
103+ + get_luajit
104+ + get_libluajit
105+ + get_gtdialog
106+ + get_cdk
107+ + get_bombay
108+ + get_termkey;
21109in
22−stdenv.mkDerivation rec{
23− version = "8.2";
24− scintillua_version = "3.6.0-1";
110+stdenv.mkDerivation rec {
111+ version = "8.7";
25112 name = "textadept-${version}";
26− inherit buildInputs;
113+
114+ buildInputs = [
115+ gtk glib pkgconfig unzip ncurses zip
116+ ];
117+
27118 src = fetchhg {
28119 url = http://foicica.com/hg/textadept;
29120 rev = "textadept_${version}";
30− sha256 = "1vb6a15fyk7ixcv5fy0g400lxbj6dp5ndbmyx53d28idbdkz9ap1";
121+ sha256 = "1gi73wk11w3rbkxqqdp8z9g83qiyhx6gxry221vxjxpqsl9pvhlf";
31122 };
123+
32124 preConfigure = ''
33125 cd src
126+
127+ # Make a dummy wget.
34128 mkdir wget
35129 echo '#! ${stdenv.shell}' > wget/wget
36130 chmod a+x wget/wget
37131 export PATH="$PATH:$PWD/wget"
38− ${get_url http://prdownloads.sourceforge.net/scintilla/scintilla360.tgz "07ib4w3n9kqfaia2yngj2q7ab5r55zn0hccfzph6vas9hl8vk9zf"}
39− ${get_url http://foicica.com/scinterm/download/scinterm_1.6.zip "0ixwj9il6ri1xl4nvb6f108z4qhrahysza6frbbaqmbdz21hnmcl"}
40− ${get_url http://foicica.com/scintillua/download/scintillua_3.6.0-1.zip "0zk1ciyyi0d3dz4dzzq5fa74505pvqf0w5yszl7l29c1l4hkk561"}
41− ${get_url http://www.lua.org/ftp/lua-5.3.1.tar.gz "05xczy5ws6d7ic3f9h9djwg983bpa4pmds3698264bncssm6f9q7"}
42− ${get_url http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-0.12.2.tar.gz "01002avq90yc8rgxa5z9a1768jm054iid3pnfpywdcfij45jgbba"}
43− ${get_url_zip http://github.com/keplerproject/luafilesystem/archive/v_1_6_3.zip "1hxcnqj53540ysyw8fzax7f09pl98b8f55s712gsglcdxp2g2pri"}
44− ${get_url http://foicica.com/lspawn/download/lspawn_1.2.zip "1fhfi274bxlsdvva5q5j0wv8hx68cmf3vnv9spllzad4jdvz82xv"}
45− ${get_url http://luajit.org/download/LuaJIT-2.0.3.tar.gz "0ydxpqkmsn2c341j4r2v6r5r0ig3kbwv3i9jran3iv81s6r6rgjm"}
46− ${get_url http://foicica.com/gtdialog/download/gtdialog_1.2.zip "0nvcldyhj8abr8jny9pbyfjwg8qfp9f2h508vjmrvr5c5fqdbbm0"}
47− ${get_url ftp://invisible-island.net/cdk/cdk-5.0-20150928.tgz "028da75d5f777a1c4184f88e34918bd273bd83bbe3c959bc11710c4f0ea2e448"}
48− mv cdk-*.tgz cdk.tar.gz
49− ${get_url_zip http://foicica.com/hg/bombay/archive/d704272c3629.zip "19dg3ky87rfy0a3319vmv18hgn9spplpznvlqnk3djh239ddpplw"}
50− mv d704*.zip bombay.zip
51− ${get_url http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.17.tar.gz "12gkrv1ldwk945qbpprnyawh0jz7rmqh18fyndbxiajyxmj97538"}
132+
133+ ${get_deps}
134+
135+ # Let the build system do whatever setup it needs to do with these files.
52136 make deps
53137 '';
138+
54139 postBuild = ''
55140 make curses
56141 '';
142+
57143 postInstall = ''
58144 make curses install PREFIX=$out MAKECMDGOALS=curses
59145 '';
60− makeFlags = ["PREFIX=$(out)"];
61− meta = {
62− inherit version;
146+
147+ makeFlags = [
148+ "PREFIX=$(out)"
149+ ];
150+
151+ meta = with stdenv.lib; {
63152 description = "An extensible text editor based on Scintilla with Lua scripting";
64− license = stdenv.lib.licenses.mit ;
65− maintainers = [stdenv.lib.maintainers.raskin];
66− platforms = stdenv.lib.platforms.linux;
67− homepage = "http://foicica.com/textadept";
153+ homepage = http://foicica.com/textadept;
154+ license = licenses.mit;
155+ maintainers = with maintainers; [ raskin mirrexagon ];
156+ platforms = platforms.linux;
68157 };
69158}