Skip to content

Commit

Permalink
baserow package
Browse files Browse the repository at this point in the history
  • Loading branch information
onny committed Oct 11, 2024
1 parent 2753a60 commit 52c83bc
Showing 1 changed file with 151 additions and 15 deletions.
166 changes: 151 additions & 15 deletions pkgs/servers/baserow/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{ lib
, fetchFromGitLab
, fetchFromGitHub
, makeWrapper
, python3
, callPackage
, antlr4_9
, nixosTests
}:

let

python = python3.override {
self = python;
packageOverrides = self: super: {
Expand All @@ -17,41 +17,88 @@ let

baserow_premium = self.buildPythonPackage rec {
pname = "baserow_premium";
version = "1.12.1";
format = "setuptools";
version = "1.17.2";
foramt = "setuptools";

src = fetchFromGitLab {
owner = "bramw";
src = fetchFromGitHub {
owner = "bram2w";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-zT2afl3QNE2dO3JXjsZXqSmm1lv3EorG3mYZLQQMQ2Q=";
hash = "sha256-eU//9iO8Eng+CcG6RlDediBHYI5EyHgGkN96Q7ZDnvI=";
};

sourceRoot = "${src.name}/premium/backend";

# https://gitlab.com/baserow/baserow/-/issues/1716
postPatch = ''
echo "fixing config package"
touch src/baserow_premium/config/__init__.py
touch src/baserow_premium/config/settings/__init__.py
'';

doCheck = false;
};

django = super.django_3;

baserow_enterprise = self.buildPythonPackage rec {
pname = "baserow_enterprise";
version = "1.17.2";
foramt = "setuptools";

src = fetchFromGitHub {
owner = "bram2w";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-eU//9iO8Eng+CcG6RlDediBHYI5EyHgGkN96Q7ZDnvI=";
};

sourceRoot = "source/enterprise/backend";

# https://gitlab.com/baserow/baserow/-/issues/1716
postPatch = ''
echo "fixing missing __init__.py"
touch src/baserow_enterprise/config/__init__.py
touch src/baserow_enterprise/config/settings/__init__.py
touch src/baserow_enterprise/api/teams/__init__.py
touch src/baserow_enterprise/api/sso/__init__.py
touch src/baserow_enterprise/api/sso/oauth2/__init__.py
touch src/baserow_enterprise/api/sso/saml/__init__.py
touch src/baserow_enterprise/api/admin/__init__.py
touch src/baserow_enterprise/api/admin/auth_provider/__init__.py
touch src/baserow_enterprise/auth_provider/__init__.py
touch src/baserow_enterprise/sso/__init__.py
touch src/baserow_enterprise/sso/oauth2/__init__.py
touch src/baserow_enterprise/sso/saml/__init__.py
'';


doCheck = false;
};

};
};
in

with python.pkgs; buildPythonApplication rec {
pname = "baserow";
version = "1.12.1";
version = "1.17.2";
format = "setuptools";

src = fetchFromGitLab {
owner = "bramw";
src = fetchFromGitHub {
owner = "bram2w";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-zT2afl3QNE2dO3JXjsZXqSmm1lv3EorG3mYZLQQMQ2Q=";
hash = "sha256-eU//9iO8Eng+CcG6RlDediBHYI5EyHgGkN96Q7ZDnvI=";
};

sourceRoot = "${src.name}/backend";

postPatch = ''
<<<<<<< HEAD
=======
<<<<<<< HEAD
>>>>>>> d93a2b7f43ab (baserow package)
# use input files to not depend on outdated peer dependencies
mv requirements/base.{in,txt}
mv requirements/dev.{in,txt}
Expand All @@ -61,19 +108,58 @@ with python.pkgs; buildPythonApplication rec {
-e 's/[~<>=].*//' -i requirements/base.txt \
-e 's/zope-interface/zope.interface/' \
-e 's/\[standard\]//'
<<<<<<< HEAD
=======
=======
echo "fixing missing __init__.py"
touch src/baserow/contrib/builder/domains/__init__.py
touch src/baserow/contrib/builder/pages/__init__.py
touch src/baserow/compat/api/trash/__init__.py
# remove dependency constraints
sed 's/[~<>=].*//' -i requirements/base.in requirements/base.txt
sed 's/zope-interface/zope.interface/' -i requirements/base.in requirements/base.txt
sed 's/\[standard\]//' -i requirements/base.in requirements/base.txt
# This variable do not support `redis+socket://`, let's separate all of them.
# https://gitlab.com/baserow/baserow/-/issues/1715
sed 's/CELERY_REDBEAT_REDIS_URL = REDIS_URL/CELERY_REDBEAT_REDIS_URL = os.getenv("REDIS_BEAT_URL", REDIS_URL)/' -i src/baserow/config/settings/base.py
sed 's/\"LOCATION\": REDIS_URL/\"LOCATION\": os.getenv("DJANGO_REDIS_URL", REDIS_URL)/' -i src/baserow/config/settings/base.py
sed 's/\"hosts\": \[REDIS_URL\]/\"hosts\": \[os.getenv("DJANGO_CHANNEL_REDIS_URL", REDIS_URL)\]/' -i src/baserow/config/settings/base.py
>>>>>>> 636805f104e1 (baserow,baserow-frontend: 1.14.0 -> 1.17.2)
>>>>>>> d93a2b7f43ab (baserow package)
'';

nativeBuildInputs = [
makeWrapper
];

propagatedBuildInputs = [
google-api-core
google-cloud-core
google-cloud-storage
google-crc32c
google-resumable-media
azure-core
azure-storage-blob
isodate
baserow_premium
baserow_enterprise
>>>>>>> 636805f104e1 (baserow,baserow-frontend: 1.14.0 -> 1.17.2)
autobahn
brotli
decorator
validators
requests-oauthlib
pysaml2
>>>>>>> d93a2b7f43ab (baserow package)
advocate
antlr4-python3-runtime
boto3
cached-property
celery-redbeat
<<<<<<< HEAD
=======
celery-singleton
>>>>>>> d93a2b7f43ab (baserow package)
channels
channels-redis
daphne
Expand All @@ -84,7 +170,12 @@ with python.pkgs; buildPythonApplication rec {
django-health-check
django-redis
django-storages
<<<<<<< HEAD
drf-jwt
=======
django-cachalot
djangorestframework-simplejwt
>>>>>>> d93a2b7f43ab (baserow package)
drf-spectacular
faker
gunicorn
Expand All @@ -104,10 +195,38 @@ with python.pkgs; buildPythonApplication rec {
unicodecsv
uvicorn
watchgod
<<<<<<< HEAD
zipp
] ++ uvicorn.optional-dependencies.standard;

postInstall = ''
=======
loguru
zipp
# OpenTelemetry dependencies…
opentelemetry-api
opentelemetry-exporter-otlp-proto-http
opentelemetry-instrumentation-asgi
opentelemetry-instrumentation-aiohttp-client
opentelemetry-instrumentation-botocore
opentelemetry-instrumentation-celery
opentelemetry-instrumentation-dbapi
opentelemetry-instrumentation-django
opentelemetry-instrumentation-grpc
opentelemetry-instrumentation-logging
opentelemetry-instrumentation-psycopg2
opentelemetry-instrumentation-redis
opentelemetry-instrumentation-requests
opentelemetry-instrumentation-wsgi
opentelemetry-instrumentation
opentelemetry-sdk
opentelemetry-semantic-conventions
opentelemetry-util-http
] ++ uvicorn.optional-dependencies.standard;
postInstall = ''
chmod +x $out/bin/baserow
wrapProgram $out/bin/baserow \
--prefix PYTHONPATH : "$PYTHONPATH" \
--prefix DJANGO_SETTINGS_MODULE : "baserow.config.settings.base"
Expand All @@ -122,6 +241,10 @@ with python.pkgs; buildPythonApplication rec {
pyinstrument
pytestCheckHook
pytest-django
<<<<<<< HEAD
=======
pytest-asyncio
>>>>>>> d93a2b7f43ab (baserow package)
pytest-unordered
responses
zope-interface
Expand All @@ -142,18 +265,32 @@ with python.pkgs; buildPythonApplication rec {
# Disable premium tests
"../premium/backend/src/baserow_premium"
"../premium/backend/tests/baserow_premium"
# Disable enterprise & premium tests
# because they require a database.
"../enterprise/backend/tests"
"../enterprise/backend/src"
"../premium/backend/tests"
"../premium/backend/src"
# Disable database related tests
"tests/baserow/contrib/database"
"tests/baserow/api"
"tests/baserow/core"
"tests/baserow/ws"
# Requires an installed app or something, investigate later
"tests/baserow/contrib/builder/"
];

doCheck = false; # our disabled tests paths are not ignored for premium/backend because of an explicit testpaths I suppose.
# todo patch it.

pythonImportsCheck = [ "baserow" "baserow_premium.config.settings" "baserow_enterprise.config.settings" ];

DJANGO_SETTINGS_MODULE = "baserow.config.settings.test";

<<<<<<< HEAD
=======
passthru = {
ui = callPackage ./frontend.nix { };
premium = baserow_premium;
enterprise = baserow_enterprise;
# PYTHONPATH of all dependencies used by the package
inherit python;
pythonPath = python.pkgs.makePythonPath propagatedBuildInputs;
Expand All @@ -163,12 +300,11 @@ with python.pkgs; buildPythonApplication rec {
};
};

>>>>>>> a7086efd42bc (nixos/tests/web-apps/baserow: init)
meta = with lib; {
description = "No-code database and Airtable alternative";
homepage = "https://baserow.io";
license = licenses.mit;
maintainers = with maintainers; [ onny ];
mainProgram = "baserow";
maintainers = with maintainers; [ raitobezarius julienmalka ];
};
}

0 comments on commit 52c83bc

Please sign in to comment.