Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@
];
forAllSystems = nixpkgs.lib.genAttrs stableSystems;

# crates.io's WAF returns 403 for the default `python-requests/X.Y.Z`
cratesIoUserAgentOverlay = final: prev: {
writers = prev.writers // {
writePython3Bin = name: settings: content:
let
patched =
if name == "fetch-cargo-vendor-util"
then builtins.replaceStrings
[ "session = requests.Session()" ]
[ "session = requests.Session()\n session.headers.update({\"User-Agent\": \"zerokit-nix\"})" ]
content
else content;
in prev.writers.writePython3Bin name settings patched;
};
};

pkgsFor = forAllSystems (
system: import nixpkgs {
inherit system;
Expand All @@ -34,6 +50,7 @@
allowUnfree = true;
};
overlays = [
cratesIoUserAgentOverlay
(import rust-overlay)
(f: p: { inherit rust-overlay; })
];
Expand Down
2 changes: 1 addition & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ in targetPlatformPkgs.rustPlatform.buildRustPackage {

inherit src;

cargoHash = "sha256-WXxQ8mAPD/mPBSnLrunhbDyCAQ0D82t1MILbo+Vfcqk=";
cargoHash = "sha256-7Ld86DIk2rk160iQgMhcX3ucZbuP45rGBxE30vkqyMk=";

nativeBuildInputs = with pkgs; [ rust-cbindgen ];

Expand Down
Loading