|
| 1 | +{ |
| 2 | + inputs = { |
| 3 | + flake-utils.url = "github:numtide/flake-utils"; |
| 4 | + flake-utils.inputs.nixpkgs.follows = "nixpkgs"; |
| 5 | + poetry2nix.url = "github:nix-community/poetry2nix"; |
| 6 | + poetry2nix.inputs.nixpkgs.follows = "nixpkgs"; |
| 7 | + poetry2nix.inputs.flake-utils.follows = "flake-utils"; |
| 8 | + }; |
| 9 | + outputs = { self, nixpkgs, flake-utils, poetry2nix }: |
| 10 | + flake-utils.lib.eachDefaultSystem (system: |
| 11 | + let |
| 12 | + pkgs = import nixpkgs { |
| 13 | + inherit system; |
| 14 | + overlays = [ poetry2nix.overlay ]; |
| 15 | + }; |
| 16 | + env = pkgs.poetry2nix.mkPoetryEnv { |
| 17 | + python = pkgs.python38Packages.python; |
| 18 | + projectDir = ./.; |
| 19 | + overrides = pkgs.poetry2nix.overrides.withDefaults (self: super: { |
| 20 | + sphinx-rtd-theme = null; |
| 21 | + cwcwidth = super.buildPythonPackage rec { |
| 22 | + pname = "cwcwidth"; |
| 23 | + version = "0.1.4"; |
| 24 | + |
| 25 | + src = super.fetchPypi { |
| 26 | + inherit pname version; |
| 27 | + sha256 = "1azrphpkcyggg38xvkfb9dpc4xmmm90p02kf8dkqd4d6j5w96aj8"; |
| 28 | + }; |
| 29 | + |
| 30 | + nativeBuildInputs = [ super.cython ]; |
| 31 | + |
| 32 | + checkInputs = [ super.pytestCheckHook ]; |
| 33 | + # Hack needed to make pytest + cython work |
| 34 | + # https://github.com/NixOS/nixpkgs/pull/82410#issuecomment-827186298 |
| 35 | + preCheck = '' |
| 36 | + export HOME=$(mktemp -d) |
| 37 | + cp -r $TMP/$sourceRoot/tests $HOME |
| 38 | + pushd $HOME |
| 39 | + ''; |
| 40 | + postCheck = "popd"; |
| 41 | + |
| 42 | + pythonImportsCheck = [ "cwcwidth" ]; |
| 43 | + }; |
| 44 | + }); |
| 45 | + editablePackageSources = { |
| 46 | + betterproto = ./src; |
| 47 | + }; |
| 48 | + }; |
| 49 | + |
| 50 | + in |
| 51 | + with pkgs; |
| 52 | + { |
| 53 | + devShell = mkShell { |
| 54 | + nativeBuildInputs = [ env python38Packages.poetry protobuf ]; |
| 55 | + }; |
| 56 | + } |
| 57 | + ); |
| 58 | +} |
0 commit comments