git.iko.soy/typeable/nixpkgs
on master help sign in
vscode: Revamp URL generation scheme

This ought to be way easier to maintain! Now just the version number and sha256 hashes need to be updated for an update, and there are no more manual cmdline steps to get version hashes and timestamps. Related to #22465

commit4a08528b4aad94332006ad4c190c3f2fa207d630 authorBenjamin Staffin <benley@gmail.com> dateThu 6 Apr 2017, 22:18 (10 years ago) parentf50258b
1 file changed+13−21
pkgs/applications/editors/vscode/default.nix+13−21
pkgs/applications/editors/vscode/default.nix+13−21
@@ -3,37 +3,29 @@
33
44let
55 version = "1.11.1";
6− rev = "d9484d12b38879b7f4cdd1150efeb2fd2c1fbf39";
76 channel = "stable";
87
9− # The revision and build timestamps can be obtained with the following
10− # command (see https://github.com/NixOS/nixpkgs/issues/22465):
11− # for a in x64 ia32; do
12− # curl -w "%{url_effective}\n" -I -L -s -S -o /dev/null \
13− # "https://vscode-update.azurewebsites.net/latest/linux-${arch}/stable" \
14− # done
8+ plat = {
9+ "i686-linux" = "linux-ia32";
10+ "x86_64-linux" = "linux-x64";
11+ "x86_64-darwin" = "darwin";
12+ }.${stdenv.system};
1513
16− sha256 = if stdenv.system == "i686-linux" then "14wdblh7q3m5qdsm34dpg5p7qk6llrbqk60md8wd0fb4chpvrq94"
17− else if stdenv.system == "x86_64-linux" then "0rmzvaiar3y062mbrggiwjbwxs7izcih5333rn208ax4jxmbk4pc"
18− else if stdenv.system == "x86_64-darwin" then "1f3zdwsz0l6r7c2k25a7j5m0dl78219jzg4axcmbfa2qcs2hw0x6"
19− else throw "Unsupported system: ${stdenv.system}";
14+ sha256 = {
15+ "i686-linux" = "14wdblh7q3m5qdsm34dpg5p7qk6llrbqk60md8wd0fb4chpvrq94";
16+ "x86_64-linux" = "0rmzvaiar3y062mbrggiwjbwxs7izcih5333rn208ax4jxmbk4pc";
17+ "x86_64-darwin" = "1f3zdwsz0l6r7c2k25a7j5m0dl78219jzg4axcmbfa2qcs2hw0x6";
18+ }.${stdenv.system};
2019
21− urlBase = "https://az764295.vo.msecnd.net/${channel}/${rev}/";
20+ archive_fmt = if stdenv.system == "x86_64-darwin" then "zip" else "tar.gz";
2221
23− urlStr = if stdenv.system == "i686-linux" then
24− urlBase + "code-${channel}-code_${version}-1491487843_i386.tar.gz"
25− else if stdenv.system == "x86_64-linux" then
26− urlBase + "code-${channel}-code_${version}-1491486998_amd64.tar.gz"
27− else if stdenv.system == "x86_64-darwin" then
28− urlBase + "VSCode-darwin-${channel}.zip"
29− else throw "Unsupported system: ${stdenv.system}";
3022in
3123 stdenv.mkDerivation rec {
3224 name = "vscode-${version}";
33− inherit version;
3425
3526 src = fetchurl {
36− url = urlStr;
27+ name = "VSCode_${version}_${plat}.${archive_fmt}";
28+ url = "https://vscode-update.azurewebsites.net/${version}/${plat}/${channel}";
3729 inherit sha256;
3830 };
3931