Skip to content

Commit

Permalink
Less repetitiveness in Nix files
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar committed Dec 2, 2023
1 parent d364e47 commit 3db0f57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@
};
};
packages = {
# Besides the `src` and `version` arguments, this package.nix could
# Besides the `src` and `cargoTomlPkg` arguments, this package.nix could
# be copied as is to Nixpkgs'
# pkgs/development/python-modules/pysequoia/default.nix, and should be
# maintained in parallel to this local version of it.
pysequoia = pkgs.python3.pkgs.callPackage ./package.nix {
src = self;
# Get the version defined in pyproject.toml
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
cargoTomlPkg = builtins.fromTOML (builtins.readFile ./Cargo.toml).package;
};
};
}
Expand Down
19 changes: 11 additions & 8 deletions package.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, src
, version
, cargoTomlPkg
, pkg-config
, rustPlatform
, cargo
Expand All @@ -17,7 +17,8 @@

buildPythonPackage rec {
pname = "pysequoia";
inherit src version;
inherit src;
inherit (cargoTomlPkg) version;
pyproject = true;

# This attribute is defined differently in Nixpkgs - using
Expand Down Expand Up @@ -50,11 +51,13 @@ buildPythonPackage rec {

pythonImportsCheck = [ "pysequoia" ];

meta = with lib; {
description = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.description;
downloadPage = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.repository;
homepage = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.homepage;
license = licenses.asl20;
maintainers = with maintainers; [ doronbehar ];
meta = {
inherit (cargoTomlPkg)
description
homepage
;
downloadPage = cargoTomlPkg.repository;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ doronbehar ];
};
}

0 comments on commit 3db0f57

Please sign in to comment.