diff options
| author | seth <[email protected]> | 2023-09-28 04:56:44 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2023-09-28 04:56:44 -0400 |
| commit | 55d0da1263edeb0af3553c178ca9d9b044e73694 (patch) | |
| tree | c0b02d19177bda1f59c26476d95718cdbdcd59a2 /nix | |
| parent | b7669b106d397f4823ef8cf52496053d624f0d7c (diff) | |
fix(flake): use custom buildPhase instead of pypBuildHook
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/derivation.nix | 16 | ||||
| -rw-r--r-- | nix/dev.nix | 10 | ||||
| -rw-r--r-- | nix/packages.nix | 31 |
3 files changed, 31 insertions, 26 deletions
diff --git a/nix/derivation.nix b/nix/derivation.nix index 4e32095..483aeef 100644 --- a/nix/derivation.nix +++ b/nix/derivation.nix @@ -6,16 +6,26 @@ pydantic, uvicorn, self, - version, + build, + wheel, }: buildPythonPackage { pname = "guzzle-api"; - inherit version; + version = builtins.substring 0 8 self.lastModifiedDate or "dirty"; src = lib.cleanSource self; format = "flit"; doCheck = false; + dontUsePypaBuild = true; + + # TODO: find out what's going on with pypaBuildHook + buildPhase = '' + runHook preBuild + pyproject-build --no-isolation --outdir dist/ --wheel $pypaBuildFlags + runHook postBuild + ''; + propagatedBuildInputs = [fastapi pydantic uvicorn]; - propagatedNativeBuildInputs = [flit-core]; + nativeBuildInputs = [flit-core build wheel]; } diff --git a/nix/dev.nix b/nix/dev.nix index b394c6c..9ebb07f 100644 --- a/nix/dev.nix +++ b/nix/dev.nix @@ -5,8 +5,9 @@ ... }: { perSystem = { - config, pkgs, + config, + self', ... }: { pre-commit = { @@ -24,8 +25,11 @@ devShells.default = pkgs.mkShell { shellHook = config.pre-commit.installationScript; - packages = [ - (pkgs.python311.withPackages (p: with p; [isort yapf pylint])) + inputsFrom = [self'.packages.guzzle-api]; + packages = with pkgs.python311Packages; [ + isort + yapf + pylint ]; }; }; diff --git a/nix/packages.nix b/nix/packages.nix index 8722ad1..bc679c7 100644 --- a/nix/packages.nix +++ b/nix/packages.nix @@ -1,29 +1,20 @@ -{self, ...}: let - version = builtins.substring 0 8 self.lastModifiedDate or "dirty"; - commonArgs = {inherit self version;}; -in { +{self, ...}: { perSystem = { + lib, pkgs, - self', ... - }: { + }: let + pkgs' = lib.fix (final: self.overlays.default final pkgs); + in { packages = { - guzzle-api = pkgs.python311Packages.callPackage ./derivation.nix commonArgs; - guzzle-api-server = pkgs.python311Packages.callPackage ./server.nix {inherit (self'.packages) guzzle-api;}; - default = self'.packages.guzzle-api; + inherit (pkgs') guzzle-api guzzle-api-server; + default = pkgs'.guzzle-api-server; }; }; - flake.overlays.default = final: prev: { - python = prev.python.override { - packageOverrides = _: prev': { - guzzle-api = prev'.callPackage ./derivation.nix commonArgs; - }; + flake.overlays.default = final: prev: + with prev.python311Packages; { + guzzle-api = callPackage ./derivation.nix {inherit self;}; + guzzle-api-server = callPackage ./server.nix {inherit (final) guzzle-api;}; }; - - pythonPackages = final.python.pkgs; - - guzzle-api = final.pythonPackages.callPackage ./derivation.nix commonArgs; - guzzle-api-server = final.pythonPackages.callPackage ./server.nix {}; - }; } |
