Skip to content

Commit

Permalink
build(nix): make build non-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
liferooter authored and WeetHet committed Dec 21, 2024
1 parent 9b37b80 commit a562da3
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
};

outputs =
inputs@{ flake-parts, pyproject-nix, ... }:
inputs@{ self, flake-parts, pyproject-nix, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
Expand All @@ -33,7 +33,10 @@
python = pkgs.python3.override {
packageOverrides = import ./nix/mkPackageOverrides.nix { inherit pkgs; };
};
packageAttrs = import ./nix/mkPackageAttrs.nix { inherit pkgs project python; };
packageAttrs = import ./nix/mkPackageAttrs.nix {
inherit pkgs project python;
rev = self.rev or null;
};
in
{
packages = {
Expand Down
44 changes: 29 additions & 15 deletions nix/mkPackageAttrs.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
{ pkgs, project, python }:
(project.renderers.buildPythonPackage { inherit python; }) // {
src = ./..;
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "cryptg-anyos" "cryptg"
'';
pythonRelaxDeps = [
"cryptg"
];
meta = {
license = pkgs.lib.licenses.mit;
homepage = "https://tgpy.tmat.me/";
pythonImportsCheck = [ "tgpy" ];
{
pkgs,
project,
python,
rev,
}:
let
postPatch =
''
substituteInPlace pyproject.toml \
--replace-fail "cryptg-anyos" "cryptg"
''
+ pkgs.lib.optionalString (rev != null) ''
substituteInPlace tgpy/version.py \
--replace-fail "COMMIT_HASH = None" "COMMIT_HASH = \"${rev}\""
'';
newAttrs = {
src = ./..;
inherit postPatch;
pythonRelaxDeps = [
"cryptg"
];
meta = {
license = pkgs.lib.licenses.mit;
homepage = "https://tgpy.tmat.me/";
pythonImportsCheck = [ "tgpy" ];
};
};
}
in
(project.renderers.buildPythonPackage { inherit python; }) // newAttrs

0 comments on commit a562da3

Please sign in to comment.