Init flake and make project buildable

This commit is contained in:
2024-11-21 09:55:17 +01:00
parent 2b94bc6b3e
commit fa6704f5cd
12 changed files with 402 additions and 16 deletions

50
package.nix Normal file
View 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];
};
}