summary refs log tree commit diff
path: root/pkgs/applications/misc/weather/default.nix
blob: ce4fae1cb2293ba2bc76547c8a68619cf00beec8 (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
{ stdenv, fetchurl, pythonPackages }:

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

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

    nativeBuildInputs = [ pythonPackages.wrapPython ];

    buildInputs = [ pythonPackages.python ];

    phases = [ "unpackPhase" "installPhase" ];

    installPhase = ''
        site_packages=$out/${pythonPackages.python.sitePackages}
        mkdir -p $out/{share/{man,weather-util},bin,etc} $site_packages
        cp weather $out/bin/
        cp weather.py $site_packages/
        chmod +x $out/bin/weather
        cp airports overrides.{conf,log} places slist stations zctas zlist zones $out/share/weather-util/
        cp weatherrc $out/etc
        cp weather.1 weatherrc.5 $out/share/man/
        sed -i \
          -e "s|/etc|$out/etc|g" \
          -e "s|else: default_setpath = \".:~/.weather|&:$out/share/weather-util|" \
          $site_packages/weather.py
        wrapPythonPrograms
    '';

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