nixpkgs-suyu/pkgs/applications/misc/weather/default.nix

49 lines
1.3 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, pythonPackages, installShellFiles }:
2015-11-26 17:28:38 +01:00
stdenv.mkDerivation rec {
2020-09-22 06:50:04 +02:00
version = "2.4.1";
pname = "weather";
2015-11-26 17:28:38 +01:00
2020-09-22 06:50:04 +02:00
src = fetchurl {
url = "http://fungi.yuggoth.org/weather/src/${pname}-${version}.tar.xz";
sha256 = "0nf680dl7a2vlgavdhj6ljq8a7lkhvr6zghkpzad53vmilxsndys";
};
2015-11-26 17:28:38 +01:00
2020-09-22 07:45:00 +02:00
nativeBuildInputs = [
installShellFiles
pythonPackages.wrapPython
];
2020-09-22 07:45:00 +02:00
dontConfigure = true;
dontBuild = true;
2015-11-26 17:28:38 +01:00
2020-09-22 07:45:00 +02:00
# Upstream doesn't provide a setup.py or alike, so we follow:
# http://fungi.yuggoth.org/weather/doc/install.rst#id3
2020-09-22 06:50:04 +02:00
installPhase = ''
site_packages=$out/${pythonPackages.python.sitePackages}
2020-09-22 07:45:00 +02:00
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
2020-09-22 06:50:04 +02:00
sed -i \
-e "s|/etc|$out/etc|g" \
-e "s|else: default_setpath = \".:~/.weather|&:$out/share/weather-util|" \
$site_packages/weather.py
2020-09-22 07:45:00 +02:00
2020-09-22 06:50:04 +02:00
wrapPythonPrograms
2020-09-22 07:45:00 +02:00
installManPage weather.1 weatherrc.5
2020-09-22 06:50:04 +02:00
'';
2015-11-26 17:28:38 +01:00
meta = with lib; {
2020-09-22 06:50:04 +02:00
homepage = "http://fungi.yuggoth.org/weather";
description = "Quick access to current weather conditions and forecasts";
license = licenses.isc;
maintainers = [ maintainers.matthiasbeyer ];
2020-09-22 07:45:17 +02:00
platforms = platforms.unix;
2020-09-22 06:50:04 +02:00
};
2015-11-26 17:28:38 +01:00
}