diff --git a/flake.nix b/flake.nix index 45d2dae..cd471a2 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ let inherit (builtins) listToAttrs mapAttrs; - allPackageNames = [ "d2" "d2plugin-tala" "d2full" ]; + allPackageNames = [ "d2" "d2plugin-tala" "d2full" "fawltydeps" ]; mkAllPackages = pkgs': let d2-unwrapped = pkgs'.callPackage ./pkgs/d2/d2-unwrapped.nix { }; @@ -15,9 +15,10 @@ d2 = pkgs'.callPackage ./pkgs/d2 { inherit d2-unwrapped d2plugin-tala; }; + fawltydeps = pkgs'.callPackage ./pkgs/fawltydeps { }; in { - inherit d2 d2plugin-tala; + inherit d2 d2plugin-tala fawltydeps; d2-full = d2.override { withTala = true; }; }; diff --git a/pkgs/fawltydeps/default.nix b/pkgs/fawltydeps/default.nix new file mode 100644 index 0000000..2dbc720 --- /dev/null +++ b/pkgs/fawltydeps/default.nix @@ -0,0 +1,60 @@ +{ lib +, poetry2nix +, fetchFromGitHub +, python39 +, python39Packages +}: + +let + poetryOverrides = poetry2nix.defaultPoetryOverrides.extend (full: prev: { + colorama = prev.colorama.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.hatchling ]; + }); + iniconfig = prev.iniconfig.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.hatchling prev.hatch-vcs ]; + }); + filelock = prev.filelock.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.hatchling prev.hatch-vcs ]; + }); + packaging = prev.packaging.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.flit-core ]; + }); + pathspec = prev.pathspec.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.flit-core ]; + }); + nox = prev.nox.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.setuptools ]; + }); + exceptiongroup = prev.exceptiongroup.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ prev.flit-scm ]; + }); + mypy = prev.mypy.overridePythonAttrs (old: { + buildInputs = old.buildInputs ++ [ full.types-psutil ]; + }); + types-psutil = prev.buildPythonPackage rec { + pname = "types-psutil"; + version = "5.9.5"; + + src = prev.fetchPypi { + inherit version; + pname = "types-psutil"; + sha256 = "sha256-vvkd4Ja3f/e8OpK6/kZu5V+EIobB1zRli3wmslkHglM="; + }; + + pythonImportsCheck = [ "psutil-stubs" ]; + }; + }); + + src = fetchFromGitHub { + owner = "tweag"; + repo = "FawltyDeps"; + rev = "0201e74a158c5774db9150e1e70f01e76bad34e7"; + sha256 = "sha256-kSAy6IOS+G+e7hG4ZseglhOsnJ7Tg87MaMRCWUoSJdA="; + }; +in +poetry2nix.mkPoetryApplication { + version = "2023-03-14"; + python = python39; + projectDir = "${src}"; + overrides = poetryOverrides; +}