]> rtime.felk.cvut.cz Git - coffee/main.git/blobdiff - shell.nix
README: Document how to use nix-shell for development
[coffee/main.git] / shell.nix
index a03c7e5fe9721201ea133cae609cb9b4a6e67282..15c9ebccef8b716127ba261302e13f2e2715bb26 100644 (file)
--- a/shell.nix
+++ b/shell.nix
@@ -1,19 +1,29 @@
-with import <nixpkgs> {};
+{ sources ? import ./nix/sources.nix
+, nixpkgs ? sources.nixpkgs
+, pkgs ? import nixpkgs {}
+}:
+
+with pkgs;
 
 let
   pythonEnv = (let
     python = let
       packageOverrides = self: super: {
-        matplotlib = super.matplotlib.overridePythonAttrs(old: rec {
-          version = "3.0.2";
+        matplotlib = (super.matplotlib.override { enableTk = false; }).overridePythonAttrs(old: rec {
+          version = "3.3.4";
           src =  super.fetchPypi {
             pname = "matplotlib";
             inherit version;
-            sha256 = "1brn3ism9755wibylb24yzs3b6ndg89iiclyhnvavxiiyhm7jjy9";
+            sha256 = "1c15g3rhnp4pn46akwzqqgrwvalhsy44zi3nd169x4i2djvpsiry";
           };
+
+          # qhull library in nixpkgs in newer than expected by matplotlib 3.3.4 and has a different name
+          postPatch = old.postPatch + ''
+            substituteInPlace setupext.py --replace 'ext.libraries.append("qhull")' 'ext.libraries.append("qhull_r")'
+          '';
         });
         flask = super.flask.overridePythonAttrs(old: rec {
-          version = "1.0.2";
+          version = "1.1.2";
           src =  super.fetchPypi {
             pname = "Flask";
             inherit version;
@@ -24,13 +34,20 @@ let
           '';
         });
         flask-cors = super.flask-cors.overridePythonAttrs(old: rec {
-          version = "3.0.7";
+          version = "3.0.9";
           src =  super.fetchPypi {
             pname = "Flask-Cors";
             inherit version;
             sha256 = "1v6gq4vjgyxi8q8lxawpdfhq01adb4bznnabp08ks5nzbwibz43y";
           };
         });
+        jinja2 = super.jinja2.overridePythonAttrs(old: rec {
+          version = "2.11.3";
+          src = old.src.override {
+            inherit version;
+            sha256 = "1iiklf3wns67y5lfcacxma5vxfpb7h2a67xbghs01s0avqrq9md6";
+          };
+        });
 
         # Workarounds for two Flask/Nix-related errors when FLASK_DEBUG = 1.
         #
@@ -58,9 +75,10 @@ let
           '';
         });
       };
-    in pkgs.python37.override {inherit packageOverrides; self = python;};
+    in pkgs.python39.override {inherit packageOverrides; self = python;};
 
   in python.withPackages(ps: with ps; [
+    flake8                      # For syntax checking while editing .py files
     flask
     flask-cors
     matplotlib
@@ -72,6 +90,7 @@ in mkShell {
     openssl
     pythonEnv
     zlib
+    pkg-config
   ];
   FLASK_DEBUG = 1;