revbank-inflatinator/flake.nix
polyfloyd 0046dfc8d8
All checks were successful
Test / test (push) Successful in 1m15s
Fix editable flake
2025-07-17 18:22:43 +02:00

55 lines
1.9 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { system = system; };
pyprojecttoml = nixpkgs.lib.importTOML ./pyproject.toml;
supermarktconnector = pkgs.python3Packages.buildPythonPackage {
pname = "supermarktconnector";
version = "0.8.1-2";
format = "setuptools";
src = pkgs.fetchFromGitHub {
owner = "bartmachielsen";
repo = "SupermarktConnector";
rev = "393c8698a34393f233a0bef45022954bfabe4247";
hash = "sha256-OuCcwh58HdEsA2h6WGEgKDcyw4RH4NzHlVr7kY3DEHE=";
};
};
in rec {
packages.default = pkgs.python3Packages.buildPythonApplication {
pname = pyprojecttoml.project.name;
version = pyprojecttoml.project.version;
pyproject = true;
src = self;
dependencies = with pkgs.python3Packages; [ pyquery pytest requests ]
++ [ supermarktconnector ];
nativeBuildInputs = with pkgs.python3Packages; [ setuptools ];
nativeCheckInputs = with pkgs.python3Packages; [ pytest ]
++ [ pkgs.ruff ];
dontCheck = true; # Makes network requests.
checkPhase = ''
runHook preCheck
# No pytest, there are tests that make network requests.
ruff check
runHook postCheck
'';
};
packages.editable = pkgs.python3Packages.mkPythonEditablePackage {
inherit (packages.default) pname version dependencies;
scripts = pyprojecttoml.project.scripts;
root = "$PWD/src";
passthru = { inherit (packages.default) nativeCheckInputs; };
};
}
);
}