Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Turning python environment into Nix is actually quite hard. A lot of python packages are missing from Nixpkgs so a pure Nix solution is practically a no-go.
{ description = "Flake to manage python workspace"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/master"; flake-utils.url = "github:numtide/flake-utils"; mach-nix.url = "github:DavHau/mach-nix?ref=3.3.0"; }; outputs = { self, nixpkgs, flake-utils, mach-nix }: flake-utils.lib.eachDefaultSystem (system: let python = "python39"; # <--- change here pkgs = nixpkgs.legacyPackages.${system}; # https://github.com/DavHau/mach-nix/issues/153#issuecomment-717690154 mach-nix-wrapper = import mach-nix { inherit pkgs python; }; requirements = builtins.readFile ./requirements.txt; pythonBuild = mach-nix-wrapper.mkPython { inherit requirements; }; in { devShell = pkgs.mkShell { buildInputs = [ # dev packages (pkgs.${python}.withPackages (ps: with ps; [ pip black pyflakes isort ])) # <--- change here pkgs.nodePackages.pyright pkgs.glpk # app packages pythonBuild ]; }; }); }