1{ lib, stdenv, fetchurl, python3, installShellFiles }:
2
3stdenv.mkDerivation rec {
4 version = "2.4.4";
5 pname = "weather";
6
7 src = fetchurl {
8 url = "http://fungi.yuggoth.org/weather/src/${pname}-${version}.tar.xz";
9 sha256 = "sha256-uBwcntmLmIAztbIOHEDx0Y0/kcoJqAHqBOM2yBiRHrU=";
10 };
11
12 nativeBuildInputs = [
13 installShellFiles
14 python3.pkgs.wrapPython
15 ];
16
17 dontConfigure = true;
18 dontBuild = true;
19
20 # Upstream doesn't provide a setup.py or alike, so we follow:
21 # http://fungi.yuggoth.org/weather/doc/install.rst#id3
22 installPhase = ''
23 site_packages=$out/${python3.sitePackages}
24 install -Dt $out/bin -m 755 weather
25 install -Dt $site_packages weather.py
26 install -Dt $out/share/weather-util \
27 airports overrides.{conf,log} places slist stations \
28 zctas zlist zones
29 install -Dt $out/etc weatherrc
30
31 sed -i \
32 -e "s|/etc|$out/etc|g" \
33 -e "s|else: default_setpath = \".:~/.weather|&:$out/share/weather-util|" \
34 $site_packages/weather.py
35
36 wrapPythonPrograms
37
38 installManPage weather.1 weatherrc.5
39 '';
40
41 meta = with lib; {
42 homepage = "http://fungi.yuggoth.org/weather";
43 description = "Quick access to current weather conditions and forecasts";
44 license = licenses.isc;
45 maintainers = [ maintainers.matthiasbeyer ];
46 platforms = platforms.unix;
47 };
48}