nixpkgs/pkgs/by-name/py/pytrainer/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

100 lines
1.8 KiB
Nix

{ lib
, python3
, fetchFromGitHub
, gdk-pixbuf
, adwaita-icon-theme
, gpsbabel
, glib-networking
, glibcLocales
, gobject-introspection
, gtk3
, perl
, sqlite
, tzdata
, webkitgtk_4_0
, wrapGAppsHook3
, xvfb-run
}:
let
python = python3.override {
self = python;
packageOverrides = (self: super: {
matplotlib = super.matplotlib.override {
enableGtk3 = true;
};
});
};
in python.pkgs.buildPythonApplication rec {
pname = "pytrainer";
version = "2.2.1";
src = fetchFromGitHub {
owner = "pytrainer";
repo = "pytrainer";
rev = "v${version}";
hash = "sha256-t61vHVTKN5KsjrgbhzljB7UZdRask7qfYISd+++QbV0=";
};
propagatedBuildInputs = with python.pkgs; [
sqlalchemy
python-dateutil
matplotlib
lxml
setuptools
requests
gdal
];
nativeBuildInputs = [
gobject-introspection
wrapGAppsHook3
];
buildInputs = [
sqlite
gtk3
webkitgtk_4_0
glib-networking
adwaita-icon-theme
gdk-pixbuf
];
makeWrapperArgs = [
"--prefix" "PATH" ":" (lib.makeBinPath [ perl gpsbabel ])
];
nativeCheckInputs = [
glibcLocales
perl
xvfb-run
] ++ (with python.pkgs; [
mysqlclient
psycopg2
]);
postPatch = ''
substituteInPlace pytrainer/platform.py \
--replace 'sys.prefix' "\"$out\""
'';
checkPhase = ''
env \
HOME=$TEMPDIR \
TZDIR=${tzdata}/share/zoneinfo \
TZ=Europe/Kaliningrad \
LC_TIME=C \
xvfb-run -s '-screen 0 800x600x24' \
${python.interpreter} -m unittest
'';
meta = with lib; {
homepage = "https://github.com/pytrainer/pytrainer";
description = "Application for logging and graphing sporting excursions";
mainProgram = "pytrainer";
maintainers = with maintainers; [ rycee dotlambda ];
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}