From 994a4ad18be689aad8571f913a2829c122436375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 16 Jan 2024 00:34:11 +0200 Subject: [PATCH] django_5: override globally --- flake.nix | 13 ++++++++++++- modules/e11sync/default.nix | 3 --- pkgs/e11sync-backend.nix | 25 ++++++++----------------- pkgs/e11sync-static.nix | 2 +- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/flake.nix b/flake.nix index ea4d400..8fb6098 100644 --- a/flake.nix +++ b/flake.nix @@ -36,7 +36,18 @@ ... }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs {inherit system;}; + pkgs = import nixpkgs { + inherit system; + overlays = [ + (_: super: { + python3 = super.python3.override { + packageOverrides = _: python-super: { + django = python-super.django_5; + }; + }; + }) + ]; + }; geoip-mmdb = pkgs.callPackage ./pkgs/geoip-mmdb.nix { inherit geoip2-tarball; diff --git a/modules/e11sync/default.nix b/modules/e11sync/default.nix index 3fce6c0..f94142f 100644 --- a/modules/e11sync/default.nix +++ b/modules/e11sync/default.nix @@ -1,7 +1,6 @@ e11sync-backend: { config, lib, - pkgs, ... }: { options.e11sync = with lib.types; { @@ -11,8 +10,6 @@ e11sync-backend: { config = lib.mkIf config.e11sync.enable { environment.systemPackages = [ - pkgs.python3 - pkgs.python3Packages.django_5 e11sync-backend ]; }; diff --git a/pkgs/e11sync-backend.nix b/pkgs/e11sync-backend.nix index 935301c..e4fdd34 100644 --- a/pkgs/e11sync-backend.nix +++ b/pkgs/e11sync-backend.nix @@ -14,22 +14,13 @@ }: stdenv.mkDerivation { name = "e11sync"; - propagatedBuildInputs = let - pythonEnv = - (python3.override - { - packageOverrides = _: super: { - django = super.django_5; - }; - }) - .withPackages (ps: - with ps; [ - django - django-compressor - geoip2 - ]); - in [ - pythonEnv + propagatedBuildInputs = [ + (python3.withPackages + (ps: [ + ps.django + ps.django-compressor + ps.geoip2 + ])) libmaxminddb ]; nativeBuildInputs = [makeWrapper]; @@ -59,7 +50,7 @@ stdenv.mkDerivation { runCommand "e11sync-test" { src = ../app; buildInputs = [ - python3Packages.django_5 + python3Packages.django python3Packages.django-compressor python3Packages.geoip2 dart-sass diff --git a/pkgs/e11sync-static.nix b/pkgs/e11sync-static.nix index 272a26f..ba29f71 100644 --- a/pkgs/e11sync-static.nix +++ b/pkgs/e11sync-static.nix @@ -11,7 +11,7 @@ stdenv.mkDerivation { name = "e11sync-static"; src = ../app; nativeBuildInputs = [ - python3Packages.django_5 + python3Packages.django python3Packages.django-compressor dart-sass ];