nixpkgs/pkgs/by-name/pa/pacu/package.nix
adisbladis e0816431a2 treewide: Pass self when overriding Python
Otherwise references to the Python interpreter inside the set are wrong, as demonstrated by:
``` nix
with import <nixpkgs> { };
let
  python' = python3.override {
    packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337";  }); };
  };
in python'.pkgs.python.pkgs.requests
```
which returns the _non_ overriden requests.

And the same with `self`:
```
with import <nixpkgs> { };
let
  python' = python3.override {
    self = python';
    packageOverrides = final: prev: { requests = prev.requests.overridePythonAttrs(old: { version = "1337";  }); };
  };
in python'.pkgs.python.pkgs.requests
```
which returns the overriden requests.

This can manifest itself as file collisions when constructing environments or as subtly incorrect dependency graphs.
2024-08-03 12:18:56 +12:00

84 lines
1.5 KiB
Nix

{
lib,
awscli,
fetchFromGitHub,
python3,
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: { sqlalchemy = super.sqlalchemy_1_4; };
};
in
python.pkgs.buildPythonApplication rec {
pname = "pacu";
version = "1.6.0";
pyproject = true;
src = fetchFromGitHub {
owner = "RhinoSecurityLabs";
repo = "pacu";
rev = "refs/tags/v${version}";
hash = "sha256-Td5H4O6/7Gh/rvP191xjCJmIbyc4ezZC5Fh4FZ39ZUM=";
};
pythonRelaxDeps = [
"dsnap"
"sqlalchemy-utils"
"sqlalchemy"
"pycognito"
"urllib3"
];
build-system = with python.pkgs; [ poetry-core ];
dependencies =
[ awscli ]
++ (with python.pkgs; [
awscli
boto3
botocore
chalice
dsnap
jq
policyuniverse
pycognito
pyyaml
qrcode
requests
sqlalchemy
sqlalchemy-utils
toml
typing-extensions
urllib3
]);
nativeCheckInputs = with python.pkgs; [
moto
pytestCheckHook
];
postBuild = ''
export HOME=$(mktemp -d)
'';
pythonImportsCheck = [ "pacu" ];
disabledTests = [
# sAttributeError: module 'moto' has no attribute 'mock_s3'
"test_update"
"test_update_second_time"
];
meta = with lib; {
description = "AWS exploitation framework";
homepage = "https://github.com/RhinoSecurityLabs/pacu";
changelog = "https://github.com/RhinoSecurityLabs/pacu/releases/tag/v${version}";
license = licenses.bsd3;
maintainers = with maintainers; [ fab ];
mainProgram = "pacu";
};
}