nixpkgs/pkgs/servers/etebase/default.nix
adisbladis e0816431a2 treewide: Pass self when overriding Python
Otherwise references to the Python interpreter inside the set are wrong, as demonstrated by:
``` nix
with import <nixpkgs> { };
let
  python' = python3.override {
    packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337";  }); };
  };
in python'.pkgs.python.pkgs.requests
```
which returns the _non_ overriden requests.

And the same with `self`:
```
with import <nixpkgs> { };
let
  python' = python3.override {
    self = python';
    packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337";  }); };
  };
in python'.pkgs.python.pkgs.requests
```
which returns the overriden requests.

This can manifest itself as file collisions when constructing environments or as subtly incorrect dependency graphs.
2024-08-03 12:18:56 +12:00

75 lines
1.7 KiB
Nix

{ lib
, fetchFromGitHub
, python3
, withLdap ? false
, withPostgres ? true
, nix-update-script
, nixosTests
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: {
pydantic = super.pydantic_1;
};
};
in
python.pkgs.buildPythonApplication rec {
pname = "etebase-server";
version = "0.13.1";
src = fetchFromGitHub {
owner = "etesync";
repo = "server";
rev = "refs/tags/v${version}";
hash = "sha256-GEieXue3Kvc4zZjfypKLmTmhNPbn/GR8g0qEqkl+wkw=";
};
patches = [ ./secret.patch ];
doCheck = false;
propagatedBuildInputs = with python.pkgs; [
aiofiles
django_4
fastapi
msgpack
pynacl
redis
uvicorn
websockets
watchfiles
uvloop
pyyaml
python-dotenv
httptools
typing-extensions
] ++ lib.optional withLdap python-ldap
++ lib.optional withPostgres psycopg2;
postInstall = ''
mkdir -p $out/bin $out/lib
cp manage.py $out/bin/etebase-server
wrapProgram $out/bin/etebase-server --prefix PYTHONPATH : "$PYTHONPATH"
chmod +x $out/bin/etebase-server
'';
passthru.updateScript = nix-update-script {};
passthru.python = python;
# PYTHONPATH of all dependencies used by the package
passthru.pythonPath = python.pkgs.makePythonPath propagatedBuildInputs;
passthru.tests = {
nixosTest = nixosTests.etebase-server;
};
meta = with lib; {
homepage = "https://github.com/etesync/server";
description = "Etebase (EteSync 2.0) server so you can run your own";
mainProgram = "etebase-server";
changelog = "https://github.com/etesync/server/blob/${version}/ChangeLog.md";
license = licenses.agpl3Only;
maintainers = with maintainers; [ felschr phaer ];
};
}