Init flake and make project buildable
This commit is contained in:
50
package.nix
Normal file
50
package.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
dream2nix,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
pyproject = lib.importTOML (config.mkDerivation.src + /pyproject.toml);
|
||||
in rec {
|
||||
imports = [
|
||||
dream2nix.modules.dream2nix.pip
|
||||
];
|
||||
|
||||
inherit (pyproject.project) name version;
|
||||
|
||||
deps = {nixpkgs, ...}: {
|
||||
python = nixpkgs.python3;
|
||||
inherit (nixpkgs) openssl;
|
||||
};
|
||||
|
||||
mkDerivation = {
|
||||
src = lib.cleanSourceWith {
|
||||
src = lib.cleanSource ./.;
|
||||
filter = name: type:
|
||||
!(builtins.any (x: x) [
|
||||
(lib.hasSuffix ".nix" name)
|
||||
(lib.hasPrefix "." (builtins.baseNameOf name))
|
||||
(lib.hasSuffix "flake.lock" name)
|
||||
]);
|
||||
};
|
||||
};
|
||||
|
||||
buildPythonPackage = {
|
||||
pyproject = true; #
|
||||
pythonImportsCheck = [
|
||||
"hcpy"
|
||||
];
|
||||
};
|
||||
|
||||
pip = {
|
||||
# requirementsList = lib.splitString "\n" (builtins.readFile (config.mkDerivation.src + /requirements.txt));
|
||||
requirementsList =
|
||||
pyproject.build-system.requires
|
||||
or []
|
||||
++ pyproject.project.dependencies or [];
|
||||
flattenDependencies = true;
|
||||
|
||||
overrides.sslpsk.mkDerivation.buildInputs = [config.deps.openssl];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user