nixpkgs/pkgs/by-name/fi/fittrackee/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

115 lines
2.2 KiB
Nix

{
fetchFromGitHub,
fetchPypi,
lib,
stdenv,
postgresql,
postgresqlTestHook,
python3,
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: {
sqlalchemy = super.sqlalchemy_1_4;
flask-sqlalchemy = super.flask-sqlalchemy.overridePythonAttrs (oldAttrs: rec {
version = "3.0.5";
src = fetchPypi {
pname = "flask_sqlalchemy";
inherit version;
hash = "sha256-xXZeWMoUVAG1IQbA9GF4VpJDxdolVWviwjHsxghnxbE=";
};
});
};
};
in
python.pkgs.buildPythonApplication rec {
pname = "fittrackee";
version = "0.8.9";
pyproject = true;
src = fetchFromGitHub {
owner = "SamR1";
repo = "FitTrackee";
rev = "refs/tags/v${version}";
hash = "sha256-raN6Ef/Z/JbdJDMKBIaBL8nmvFwvuZFX4rfC0ZgWgKI=";
};
build-system = [
python.pkgs.poetry-core
];
pythonRelaxDeps = [
"authlib"
"flask-limiter"
"gunicorn"
"pyjwt"
"pyopenssl"
"pytz"
"sqlalchemy"
];
dependencies =
with python.pkgs;
[
authlib
babel
click
dramatiq
flask
flask-bcrypt
flask-dramatiq
flask-limiter
flask-migrate
flask-sqlalchemy
gpxpy
gunicorn
humanize
psycopg2-binary
pyjwt
pyopenssl
pytz
shortuuid
sqlalchemy
staticmap
ua-parser
]
++ dramatiq.optional-dependencies.redis
++ flask-limiter.optional-dependencies.redis;
pythonImportsCheck = [ "fittrackee" ];
nativeCheckInputs = with python.pkgs; [
pytestCheckHook
freezegun
postgresqlTestHook
postgresql
time-machine
];
pytestFlagsArray = [
"fittrackee"
];
postgresqlTestSetupPost = ''
export DATABASE_TEST_URL=postgresql://$PGUSER/$PGDATABASE?host=$PGHOST
'';
doCheck = !stdenv.hostPlatform.isDarwin; # tests are a bit flaky on darwin
preCheck = ''
export TMP=$TMPDIR
'';
meta = {
description = "Self-hosted outdoor activity tracker";
homepage = "https://github.com/SamR1/FitTrackee";
changelog = "https://github.com/SamR1/FitTrackee/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ traxys ];
};
}