nixpkgs/pkgs/by-name/we/weather/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

50 lines
1.3 KiB
Nix

{ lib, stdenv, fetchurl, python3, installShellFiles }:
stdenv.mkDerivation rec {
version = "2.5.0";
pname = "weather";
src = fetchurl {
url = "http://fungi.yuggoth.org/weather/src/${pname}-${version}.tar.xz";
sha256 = "sha256-wn3cpgfrlqntMIiVFh4317DrbGgQ4YRnFz3KHXacTw4=";
};
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";
mainProgram = "weather";
license = licenses.isc;
maintainers = [ maintainers.matthiasbeyer ];
platforms = platforms.unix;
};
}