refactor(coloryou): properly package with hatchling

This commit is contained in:
matt1432 2025-03-22 16:36:57 -04:00
parent 8720d95e76
commit 4128141cb7
4 changed files with 27 additions and 24 deletions

View file

@ -1,25 +1,30 @@
{python3Packages, ...}: let {
inherit (builtins.fromTOML (builtins.readFile ./pyproject.toml)) project; # nix build inputs
lib,
buildPythonApplication,
# deps
hatchling,
material-color-utilities,
...
}: let
inherit (builtins) fromTOML readFile;
inherit (fromTOML (readFile ./pyproject.toml)) project;
in in
python3Packages.buildPythonPackage { buildPythonApplication rec {
pname = project.name; pname = project.name;
inherit (project) version; inherit (project) version;
pyproject = true; format = "pyproject";
src = ./.; src = ./.;
nativeBuildInputs = with python3Packages; [ build-system = [hatchling];
setuptools dependencies = [material-color-utilities];
];
propagatedBuildInputs = with python3Packages; [material-color-utilities];
postInstall = ''
mv -v $out/bin/coloryou.py $out/bin/coloryou
'';
meta = { meta = {
inherit (project) description; mainProgram = pname;
license = lib.licenses.mit;
homepage = "https://git.nelim.org/matt1432/nixos-configs/src/branch/master/packages/coloryou"; homepage = "https://git.nelim.org/matt1432/nixos-configs/src/branch/master/packages/coloryou";
inherit (project) description;
}; };
} }

View file

@ -1,7 +1,3 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project] [project]
name = "coloryou" name = "coloryou"
description="Get Material You colors from an image." description="Get Material You colors from an image."
@ -10,3 +6,10 @@ version = "0.1.0"
dependencies = [ dependencies = [
"material_color_utilities_python", "material_color_utilities_python",
] ]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project.scripts]
coloryou = "coloryou:main"

View file

@ -1,5 +0,0 @@
from distutils.core import setup
setup(
scripts=['coloryou.py',],
)

View file

@ -4,7 +4,7 @@
... ...
}: (final: prev: { }: (final: prev: {
selfPackages = { selfPackages = {
coloryou = final.callPackage ./coloryou {}; coloryou = final.python3Packages.callPackage ./coloryou {};
fcft = final.callPackage ./fcft {}; fcft = final.callPackage ./fcft {};