Skip to content

Commit

Permalink
nix: build with preferWheels = false (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeetHet authored Sep 21, 2024
1 parent eb2a023 commit fb03e34
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
26 changes: 24 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,37 @@
);
in
flake-parts.lib.mkFlake { inherit inputs; } rec {
flake = {
flake = rec {
lib.mkPackageRequirements =
{ overrides, requirements }:
overrides.extend (final: prev:
builtins.mapAttrs (package: reqs:
(builtins.getAttr package prev).overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ (builtins.map (pkg: prev.${pkg}) reqs);
})
) requirements
);
lib.mkTgpy =
{ system ? null
, pkgs ? import nixpkgs { inherit system; }
, poetry2nix ? inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }
}: poetry2nix.mkPoetryApplication {
projectDir = ./.;
preferWheels = true;
preferWheels = false;
meta = readMetadata { lib = pkgs.lib; };
overrides = lib.mkPackageRequirements {
overrides = poetry2nix.defaultPoetryOverrides.extend (self: super: {
cryptg-anyos = super.cryptg-anyos.override {
preferWheel = true;
};
nh3 = import ./nix/nh3overrides.nix { inherit self super pkgs; };
});
requirements = {
telethon-v1-24 = [ "setuptools" ];
pipreqs = [ "setuptools" ];
python-semantic-release = [ "setuptools" ];
};
};
};
};

Expand Down
17 changes: 17 additions & 0 deletions nix/nh3overrides.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{ super, pkgs, ... }:
super.nh3.overridePythonAttrs (old: {
cargoDeps = pkgs.rustPlatform.fetchCargoTarball {
inherit (old) src;
name = "${old.pname}-${old.version}";
sha256 = "sha256-fetAE3cj9hh4SoPE72Bqco5ytUMiDqbazeS2MHdUibM=";
};
buildInputs = old.buildInputs or [ ] ++ (pkgs.lib.optionals super.stdenv.isDarwin [
pkgs.libiconv
]);
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ (with pkgs.rustPlatform; [
cargoSetupHook
maturinBuildHook
pkgs.cargo
pkgs.rustc
]);
})

0 comments on commit fb03e34

Please sign in to comment.