2
0
Fork 0
bookwyrm/nix/default.nix

121 lines
3.4 KiB
Nix
Raw Normal View History

2021-04-12 00:09:24 +02:00
{ stdenv
, lib
, poetry2nix
, gettext
, symlinkJoin
2023-06-02 17:56:14 +02:00
, pkgs
2021-04-12 00:09:24 +02:00
}:
let
2021-04-12 00:09:24 +02:00
bookwyrmSource = ./..;
poetryApp = poetry2nix.mkPoetryApplication rec {
projectDir = bookwyrmSource;
src = bookwyrmSource;
# overrides are related to deps not getting the build systems they need
# related poetry2nix issues:
# https://github.com/nix-community/poetry2nix/issues/218
# https://github.com/nix-community/poetry2nix/issues/568
2023-06-02 17:56:14 +02:00
overrides = (poetry2nix.overrides.withDefaults (final: prev: {
django-sass-processor = prev.django-sass-processor.overridePythonAttrs (
prevAttrs: {
format = "setuptools";
}
);
2023-03-17 15:47:44 +01:00
django-imagekit = prev.django-imagekit.overridePythonAttrs (
prevAttrs: {
format = "setuptools";
}
);
2023-03-17 15:47:44 +01:00
2023-06-02 17:56:14 +02:00
opentelemetry-instrumentation-celery = prev.opentelemetry-instrumentation-celery.overridePythonAttrs (
prevAttrs: {
format = "pyproject";
2023-06-02 17:56:14 +02:00
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [ final.hatchling ];
}
);
opentelemetry-instrumentation-dbapi = prev.opentelemetry-instrumentation-dbapi.overridePythonAttrs (
prevAttrs: {
format = "pyproject";
2023-06-02 17:56:14 +02:00
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [ final.hatchling ];
}
);
opentelemetry-instrumentation-psycopg2 = prev.opentelemetry-instrumentation-psycopg2.overridePythonAttrs (
prevAttrs: {
format = "pyproject";
2023-06-02 17:56:14 +02:00
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [ final.hatchling ];
}
);
bw-file-resubmit = prev.bw-file-resubmit.overridePythonAttrs (
2023-06-02 17:56:14 +02:00
prevAttrs: {
format = "pyproject";
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [ final.setuptools-scm ];
2023-06-02 17:56:14 +02:00
}
);
2024-03-27 01:42:08 +01:00
marshmallow = prev.marshmallow.overridePythonAttrs (
prevAttrs: {
format = "pyproject";
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [ final.flit-core ];
}
);
django-pgtrigger = prev.django-pgtrigger.overridePythonAttrs (
prevAttrs: {
format = "pyproject";
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []) ++ [ final.poetry-core ];
}
);
2024-06-09 22:03:34 +02:00
s3-tar = prev.s3-tar.overridePythonAttrs (
2024-03-27 01:42:08 +01:00
prevAttrs: {
2024-06-09 22:03:34 +02:00
format = "setuptools";
2024-03-27 01:42:08 +01:00
}
);
2024-06-09 22:03:34 +02:00
}));
2021-04-12 00:09:24 +02:00
meta = with lib; {
homepage = "https://bookwyrm.social/";
description = "Decentralized social reading and reviewing platform server";
license = {
fullName = "The Anti-Capitalist Software License";
url = "https://anticapitalist.software/";
free = false;
};
};
2021-04-12 00:09:24 +02:00
};
updateScripts = stdenv.mkDerivation {
name = "bookwyrm-update-scripts";
src = bookwyrmSource;
dontBuild = true;
buildInputs = [
poetryApp.dependencyEnv
];
installPhase = ''
mkdir -p $out/libexec/bookwyrm
patchShebangs manage.py
cp ./manage.py $out/libexec/bookwyrm
'';
};
# The update scripts need to be able to run manage.py under the Bookwyrm
# environment, but we don't have access to dependencyEnv when building
# poetryApp. As an ugly workaround, we patch the scripts with the right paths
# separately, and symlinkJoin them with the original environment.
in symlinkJoin {
name = "bookwyrm";
paths = [
poetryApp.dependencyEnv
updateScripts
];
}