about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/weather/default.nix
blob: 290de03f39ffe6ed914dce2a311b90d70d419b92 (plain) (blame)
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
{ lib, stdenv, fetchurl, python3, installShellFiles }:

stdenv.mkDerivation rec {
  version = "2.4.4";
  pname = "weather";

  src = fetchurl {
    url = "http://fungi.yuggoth.org/weather/src/${pname}-${version}.tar.xz";
    sha256 = "sha256-uBwcntmLmIAztbIOHEDx0Y0/kcoJqAHqBOM2yBiRHrU=";
  };

  nativeBuildInputs = [
    installShellFiles
    python3.pkgs.wrapPython
  ];

  dontConfigure = true;
  dontBuild = true;

  # Upstream doesn't provide a setup.py or alike, so we follow:
  # http://fungi.yuggoth.org/weather/doc/install.rst#id3
  installPhase = ''
    site_packages=$out/${python3.sitePackages}
    install -Dt $out/bin -m 755 weather
    install -Dt $site_packages weather.py
    install -Dt $out/share/weather-util \
      airports overrides.{conf,log} places slist stations \
      zctas zlist zones
    install -Dt $out/etc weatherrc

    sed -i \
      -e "s|/etc|$out/etc|g" \
      -e "s|else: default_setpath = \".:~/.weather|&:$out/share/weather-util|" \
      $site_packages/weather.py

    wrapPythonPrograms

    installManPage weather.1 weatherrc.5
  '';

  meta = with lib; {
    homepage = "http://fungi.yuggoth.org/weather";
    description = "Quick access to current weather conditions and forecasts";
    license = licenses.isc;
    maintainers = [ maintainers.matthiasbeyer ];
    platforms = platforms.unix;
  };
}