Skip to content
Snippets Groups Projects
default.nix 5.08 KiB
let
  sources = import nix/sources.nix;
in
{ pkgs ? import sources.release2111 { }
, pypiData ? sources.pypi-deps-db
, python ? "python39"
, mach-nix ? import sources.mach-nix { inherit pkgs pypiData python; }
, tahoe-lafs-source ? "tahoe-lafs"
, tahoe-lafs-repo ? sources.${tahoe-lafs-source}
, ...
}:
  let
    lib = pkgs.lib;
    providers = {
      _default = "sdist,nixpkgs,wheel";

      # mach-nix doesn't provide a good way to depend on mach-nix packages,
      # so we get it as a nixpkgs dependency from an overlay. See below for
      # details.
      tahoe-lafs = "nixpkgs";
      # not packaged in nixpkgs at all, we can use the binary wheel from
      # pypi though.
      python-challenge-bypass-ristretto = "wheel";
      # Pure python packages that don't build correctly from sdists
      # - patches in nixpkgs that don't apply
      boltons = "wheel";
      chardet = "wheel";
      urllib3 = "wheel";
      # - incorrectly detected dependencies due to pbr
      fixtures = "wheel";
      testtools = "wheel";
      traceback2 = "wheel";
      # - Incorrectly merged extras - https://github.com/DavHau/mach-nix/pull/334
      tqdm = "wheel";

      # The version of Klein we get doesn't need / can't have the patch that
      # comes from the nixpkgs derivation mach-nix picks up from 21.05.
      klein = "wheel";

      # - has an undetected poetry dependency and when trying to work around
      #   this another way, dependencies have undetected dependencies, easier
      #   to just use the wheel.
      collections-extended = "wheel";
      # same as collections-extended
      isort = "wheel";

      # From nixpkgs or sdist, fails with
      # cp: cannot stat 'benchmark/': No such file or directory
      # cp: cannot stat 'tests/': No such file or directory
      tomli = "wheel";

      # repo re-org or something?
      # find: ‘hypothesis-6.32.1/hypothesis-python’: No such file or directory
      hypothesis = "wheel";
    };
  in
    rec {
      inherit pkgs mach-nix;

      tahoe-lafs = mach-nix.buildPythonPackage rec {
        inherit python providers;
        name = "tahoe-lafs";
        # We add `.post999` here so that we don't accidentally *exactly* match
        # the upstream Tahoe-LAFS version.  This avoids the misleading
        # circumstance where the version in the Nix packaging *looks* like a
        # real upstream Tahoe-LAFS revision but we have forgotten to update it
        # so it is the *wrong* real upstream Tahoe-LAFS revision.  Hopefully
        # the `.post999` looks weird enough that if someone really cares about
        # the version in use they will notice it and go searching for what's
        # going on and discover the real version specified by `src` below.