Skip to content
Snippets Groups Projects
default.nix 2.43 KiB
Newer Older
Tom Prince's avatar
Tom Prince committed
let
  sources = import nix/sources.nix;
in
{ pkgs ? import sources.release2015 {}
, pypiData ? sources.pypi-deps-db
, mach-nix ? import sources.mach-nix { inherit pkgs pypiData; }
Tom Prince's avatar
Tom Prince committed
, tahoe-lafs-repo ? sources.tahoe-lafs
Tom Prince's avatar
Tom Prince committed
}:
Tom Prince's avatar
Tom Prince committed
  let
Tom Prince's avatar
Tom Prince committed
    lib = pkgs.lib;
Tom Prince's avatar
Tom Prince committed
    providers = {
      _default = "sdist,nixpkgs,wheel";
Tom Prince's avatar
Tom Prince committed
      # 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.
Tom Prince's avatar
Tom Prince committed
      tahoe-lafs = "nixpkgs";
Tom Prince's avatar
Tom Prince committed
      # 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";
Tom Prince's avatar
Tom Prince committed
      # - incorrectly detected dependencies due to pbr
      fixtures = "wheel";
      testtools = "wheel";
      traceback2 = "wheel";
Tom Prince's avatar
Tom Prince committed
      # - Incorrectly merged extras - https://github.com/DavHau/mach-nix/pull/334
      tqdm = "wheel";
Tom Prince's avatar
Tom Prince committed
    };
Tom Prince's avatar
Tom Prince committed
    tahoe-lafs = mach-nix.buildPythonPackage rec {
Tom Prince's avatar
Tom Prince committed
      python = "python27";
Tom Prince's avatar
Tom Prince committed
      name = "tahoe-lafs";
      version = "1.16.post999";
Tom Prince's avatar
Tom Prince committed
      inherit providers;
      # See https://github.com/DavHau/mach-nix/issues/190
      requirementsExtra = ''
Tom Prince's avatar
Tom Prince committed
        pyrsistent < 0.17
Tom Prince's avatar
Tom Prince committed
        foolscap == 0.13.1
        configparser
        eliot
Tom Prince's avatar
Tom Prince committed
        '';
Tom Prince's avatar
Tom Prince committed
      postPatch = ''
        cat > src/allmydata/_version.py <<EOF
        # This _version.py is generated by nix.
Tom Prince's avatar
Tom Prince committed

Tom Prince's avatar
Tom Prince committed
        verstr = "${version}+git-${tahoe-lafs-repo.rev}"
Tom Prince's avatar
Tom Prince committed
        __version__ = verstr
        EOF
      '';
Tom Prince's avatar
Tom Prince committed
      src = tahoe-lafs-repo;
Tom Prince's avatar
Tom Prince committed
    };
  in
Tom Prince's avatar
Tom Prince committed
    mach-nix.buildPythonApplication rec {
      python = "python27";
      src = ./.;
      inherit providers;
Tom Prince's avatar
Tom Prince committed
      # mach-nix does not provide a way to specify dependencies on other
      # mach-nix packages, that incorporates the requirements and overlays
      # of that package.
      # See https://github.com/DavHau/mach-nix/issues/123
      # In particular, we explicitly include the requirements of tahoe-lafs
      # here, and include it in a python package overlay.
Tom Prince's avatar
Tom Prince committed
      requirementsExtra = tahoe-lafs.requirements;
Tom Prince's avatar
Tom Prince committed
      overridesPre = [
        (
          self: super: {
            inherit tahoe-lafs;
          }
        )
      ];
Tom Prince's avatar
Tom Prince committed
      # Record some settings here, so downstream nix files can consume them.
      meta.mach-nix = { inherit python providers; };
    }