chore(mach-nix-xs): move options to .mach-nix.

This commit is contained in:
DavHau 2023-02-17 13:24:02 +07:00
parent 305b118087
commit b1679e55ef
10 changed files with 265 additions and 237 deletions

View File

@ -2,6 +2,7 @@
l = lib // builtins;
python = config.deps.python;
cfg = config.mach-nix;
packageName =
if config.name != null
@ -9,12 +10,12 @@
else config.pname;
unknownSubstitutions = l.attrNames
(l.removeAttrs config.substitutions (l.attrNames wheels));
(l.removeAttrs cfg.substitutions (l.attrNames wheels));
# Validate Substitutions. Allow only names that we actually depend on.
substitutions =
if unknownSubstitutions == []
then config.substitutions
then cfg.substitutions
else throw ''
${"\n"}The following substitutions for python derivation '${packageName}' will not have any effect. There are no dependencies with such names:
- ${lib.concatStringsSep "\n - " unknownSubstitutions}
@ -23,7 +24,7 @@
manualSetupDeps =
lib.mapAttrs
(name: deps: map (dep: wheels.${dep}) deps)
config.manualSetupDeps;
cfg.manualSetupDeps;
# Attributes we never want to copy from nixpkgs
excludedNixpkgsAttrs = l.genAttrs
@ -51,7 +52,7 @@
# (IFD) Get the dist file for a given name by looking inside (pythonSources)
distFile = name: let
distDir = "${config.pythonSources.names}/${name}";
distDir = "${cfg.pythonSources.names}/${name}";
in
"${distDir}/${l.head (l.attrNames (builtins.readDir distDir))}";
@ -124,15 +125,15 @@
);
finalPackage =
package.overridePythonAttrs config.overrides.${pname} or (_: {});
package.overridePythonAttrs cfg.overrides.${pname} or (_: {});
in
finalPackage.dist;
# all fetched dists converted to wheels
wheels =
l.mapAttrs
(name: version: ensureWheel name version (config.pythonSources.names + "/${name}"))
(config.eval-cache.content.mach-nix-dists);
(name: version: ensureWheel name version (cfg.pythonSources.names + "/${name}"))
(config.eval-cache.content.mach-nix.dists);
in {
@ -156,17 +157,17 @@ in {
};
eval-cache.fields = {
mach-nix-dists = true;
mach-nix.dists = true;
};
eval-cache.invalidationFields = {
pythonSources = true;
mach-nix.pythonSources = true;
};
mach-nix-dists =
mach-nix.dists =
l.mapAttrs
(name: _: getDistInfo name)
(l.readDir config.pythonSources.names);
(l.readDir cfg.pythonSources.names);
env = {
pipInstallFlags =

View File

@ -5,7 +5,7 @@
in {
options = {
options.mach-nix = {
pythonSources = l.mkOption {
type = t.package;
@ -48,7 +48,7 @@ in {
default = {};
};
mach-nix.lib.extractPythonAttrs = l.mkOption {
lib.extractPythonAttrs = l.mkOption {
type = t.functionTo t.attrs;
description = ''
Helper function to extract python attrs from nixpkgs to be re-used as overrides.
@ -58,7 +58,7 @@ in {
# INTERNAL
mach-nix-dists = l.mkOption {
dists = l.mkOption {
type = t.lazyAttrsOf t.anything;
description = ''
Attrs which depend onf IFD and therefore should be cached

View File

@ -0,0 +1,21 @@
{
"content": {
"mach-nix": {
"dists": {
"ansible": "2.7.1",
"bcrypt": "wheel",
"cffi": "wheel",
"cryptography": "wheel",
"jinja2": "wheel",
"markupsafe": "wheel",
"paramiko": "wheel",
"pycparser": "wheel",
"pynacl": "wheel",
"pyyaml": "wheel",
"setuptools": "wheel",
"six": "wheel"
}
}
},
"invalidationHash": "6e6b7a60133740c7579f4bb2004f4a2a2f28c5172b00da170ec4664264b73cf7"
}

View File

@ -22,10 +22,10 @@ in {
];
preUnpack = ''
export src=$(ls ${config.pythonSources}/names/${config.pname}/*);
export src=$(ls ${config.mach-nix.pythonSources}/names/${config.pname}/*);
'';
pythonSources = config.deps.fetchPythonRequirements {
mach-nix.pythonSources = config.deps.fetchPythonRequirements {
inherit (config.deps) python;
name = config.pname;
requirementsList = ["${config.pname}==${config.version}"];

View File

@ -1,115 +1,117 @@
{
"content": {
"mach-nix-dists": {
"alembic": "wheel",
"anyio": "wheel",
"apache-airflow": "wheel",
"apache-airflow_providers_common_sql": "wheel",
"apache-airflow_providers_ftp": "wheel",
"apache-airflow_providers_http": "wheel",
"apache-airflow_providers_imap": "wheel",
"apache-airflow_providers_sqlite": "wheel",
"apispec": "wheel",
"argcomplete": "wheel",
"attrs": "wheel",
"babel": "wheel",
"blinker": "wheel",
"cachelib": "wheel",
"cattrs": "wheel",
"certifi": "wheel",
"cffi": "wheel",
"charset-normalizer": "wheel",
"click": "wheel",
"clickclick": "wheel",
"colorama": "wheel",
"colorlog": "wheel",
"commonmark": "wheel",
"configupdater": "wheel",
"connexion": "wheel",
"cron-descriptor": "1.2.32",
"croniter": "wheel",
"cryptography": "wheel",
"deprecated": "wheel",
"dill": "wheel",
"dnspython": "wheel",
"docutils": "wheel",
"email-validator": "wheel",
"exceptiongroup": "wheel",
"flask": "wheel",
"flask-appbuilder": "wheel",
"flask-babel": "wheel",
"flask-caching": "wheel",
"flask-jwt_extended": "wheel",
"flask-login": "wheel",
"flask-session": "wheel",
"flask-sqlalchemy": "wheel",
"flask-wtf": "wheel",
"graphviz": "wheel",
"greenlet": "wheel",
"gunicorn": "wheel",
"h11": "wheel",
"httpcore": "wheel",
"httpx": "wheel",
"idna": "wheel",
"inflection": "wheel",
"itsdangerous": "wheel",
"jinja2": "wheel",
"jsonschema": "wheel",
"lazy-object-proxy": "1.8.0",
"linkify-it_py": "wheel",
"lockfile": "wheel",
"mako": "wheel",
"markdown": "wheel",
"markdown-it_py": "wheel",
"markupsafe": "wheel",
"marshmallow": "wheel",
"marshmallow-enum": "wheel",
"marshmallow-oneofschema": "wheel",
"marshmallow-sqlalchemy": "wheel",
"mdit-py_plugins": "wheel",
"mdurl": "wheel",
"packaging": "wheel",
"pathspec": "wheel",
"pendulum": "2.1.2",
"pluggy": "wheel",
"prison": "wheel",
"psutil": "wheel",
"pycparser": "wheel",
"pygments": "wheel",
"pyjwt": "wheel",
"pyrsistent": "wheel",
"python-daemon": "wheel",
"python-dateutil": "wheel",
"python-nvd3": "0.15.0",
"python-slugify": "wheel",
"pytz": "wheel",
"pytzdata": "wheel",
"pyyaml": "wheel",
"requests": "wheel",
"requests-toolbelt": "wheel",
"rfc3986": "wheel",
"rich": "wheel",
"setproctitle": "wheel",
"setuptools": "wheel",
"six": "wheel",
"sniffio": "wheel",
"sqlalchemy": "wheel",
"sqlalchemy-jsonfield": "wheel",
"sqlalchemy-utils": "wheel",
"sqlparse": "wheel",
"swagger-ui_bundle": "wheel",
"tabulate": "wheel",
"tenacity": "wheel",
"termcolor": "wheel",
"text-unidecode": "wheel",
"typing-extensions": "wheel",
"uc-micro_py": "wheel",
"unicodecsv": "0.14.1",
"urllib3": "wheel",
"werkzeug": "wheel",
"wrapt": "wheel",
"wtforms": "wheel"
"mach-nix": {
"dists": {
"alembic": "wheel",
"anyio": "wheel",
"apache-airflow": "wheel",
"apache-airflow_providers_common_sql": "wheel",
"apache-airflow_providers_ftp": "wheel",
"apache-airflow_providers_http": "wheel",
"apache-airflow_providers_imap": "wheel",
"apache-airflow_providers_sqlite": "wheel",
"apispec": "wheel",
"argcomplete": "wheel",
"attrs": "wheel",
"babel": "wheel",
"blinker": "wheel",
"cachelib": "wheel",
"cattrs": "wheel",
"certifi": "wheel",
"cffi": "wheel",
"charset-normalizer": "wheel",
"click": "wheel",
"clickclick": "wheel",
"colorama": "wheel",
"colorlog": "wheel",
"commonmark": "wheel",
"configupdater": "wheel",
"connexion": "wheel",
"cron-descriptor": "1.2.32",
"croniter": "wheel",
"cryptography": "wheel",
"deprecated": "wheel",
"dill": "wheel",
"dnspython": "wheel",
"docutils": "wheel",
"email-validator": "wheel",
"exceptiongroup": "wheel",
"flask": "wheel",
"flask-appbuilder": "wheel",
"flask-babel": "wheel",
"flask-caching": "wheel",
"flask-jwt_extended": "wheel",
"flask-login": "wheel",
"flask-session": "wheel",
"flask-sqlalchemy": "wheel",
"flask-wtf": "wheel",
"graphviz": "wheel",
"greenlet": "wheel",
"gunicorn": "wheel",
"h11": "wheel",
"httpcore": "wheel",
"httpx": "wheel",
"idna": "wheel",
"inflection": "wheel",
"itsdangerous": "wheel",
"jinja2": "wheel",
"jsonschema": "wheel",
"lazy-object-proxy": "1.8.0",
"linkify-it_py": "wheel",
"lockfile": "wheel",
"mako": "wheel",
"markdown": "wheel",
"markdown-it_py": "wheel",
"markupsafe": "wheel",
"marshmallow": "wheel",
"marshmallow-enum": "wheel",
"marshmallow-oneofschema": "wheel",
"marshmallow-sqlalchemy": "wheel",
"mdit-py_plugins": "wheel",
"mdurl": "wheel",
"packaging": "wheel",
"pathspec": "wheel",
"pendulum": "2.1.2",
"pluggy": "wheel",
"prison": "wheel",
"psutil": "wheel",
"pycparser": "wheel",
"pygments": "wheel",
"pyjwt": "wheel",
"pyrsistent": "wheel",
"python-daemon": "wheel",
"python-dateutil": "wheel",
"python-nvd3": "0.15.0",
"python-slugify": "wheel",
"pytz": "wheel",
"pytzdata": "wheel",
"pyyaml": "wheel",
"requests": "wheel",
"requests-toolbelt": "wheel",
"rfc3986": "wheel",
"rich": "wheel",
"setproctitle": "wheel",
"setuptools": "wheel",
"six": "wheel",
"sniffio": "wheel",
"sqlalchemy": "wheel",
"sqlalchemy-jsonfield": "wheel",
"sqlalchemy-utils": "wheel",
"sqlparse": "wheel",
"swagger-ui_bundle": "wheel",
"tabulate": "wheel",
"tenacity": "wheel",
"termcolor": "wheel",
"text-unidecode": "wheel",
"typing-extensions": "wheel",
"uc-micro_py": "wheel",
"unicodecsv": "0.14.1",
"urllib3": "wheel",
"werkzeug": "wheel",
"wrapt": "wheel",
"wtforms": "wheel"
}
}
},
"invalidationHash": "26dc9bec69845cbee3a9a289626aa2c09dd54748c4b8167769d6e373db2c9358"
"invalidationHash": "356bc5ce42e9e6b45eab35d2609b0dbc2e306b351438f48b57c7410ea4c25ed8"
}

View File

@ -32,7 +32,7 @@ in {
hash = "sha256-QWUXSG+RSHkF5kP1ZYtx+tHjO0n7hfya9CFA3lBhJHk=";
};
pythonSources = config.deps.fetchPythonRequirements {
mach-nix.pythonSources = config.deps.fetchPythonRequirements {
inherit (config.deps) python;
name = config.pname;
requirementsList = [
@ -44,7 +44,7 @@ in {
# Replace some python packages entirely with candidates from nixpkgs, because
# they are hard to fix
substitutions = {
mach-nix.substitutions = {
cron-descriptor = python.pkgs.cron-descriptor;
python-nvd3 = python.pkgs.python-nvd3;
pendulum = python.pkgs.pendulum;

View File

@ -1,65 +1,67 @@
{
"content": {
"mach-nix-dists": {
"appdirs": "wheel",
"attrs": "wheel",
"babel": "wheel",
"beautifulsoup4": "wheel",
"cached-property": "wheel",
"certifi": "wheel",
"cffi": "wheel",
"chardet": "wheel",
"cryptography": "wheel",
"decorator": "wheel",
"defusedxml": "wheel",
"docutils": "wheel",
"ebaysdk": "2.1.5",
"freezegun": "wheel",
"gevent": "21.8.0",
"greenlet": "wheel",
"idna": "wheel",
"isodate": "wheel",
"jinja2": "wheel",
"libsass": "0.18.0",
"lxml": "wheel",
"markupsafe": "1.1.0",
"num2words": "wheel",
"ofxparse": "0.21",
"passlib": "wheel",
"pillow": "wheel",
"polib": "wheel",
"psutil": "5.6.7",
"psycopg2": "2.8.6",
"pyasn1": "wheel",
"pyasn1-modules": "wheel",
"pycparser": "wheel",
"pydot": "wheel",
"pyopenssl": "wheel",
"pyparsing": "wheel",
"pypdf2": "1.26.0",
"pyserial": "wheel",
"python-dateutil": "wheel",
"python-ldap": "3.4.0",
"python-stdnum": "wheel",
"pytz": "wheel",
"pyusb": "1.0.2",
"qrcode": "wheel",
"reportlab": "3.5.59",
"requests": "wheel",
"requests-toolbelt": "wheel",
"setuptools": "wheel",
"six": "wheel",
"soupsieve": "wheel",
"urllib3": "wheel",
"vobject": "0.9.6.1",
"werkzeug": "wheel",
"xlrd": "wheel",
"xlsxwriter": "wheel",
"xlwt": "wheel",
"zeep": "wheel",
"zope-event": "wheel",
"zope-interface": "wheel"
"mach-nix": {
"dists": {
"appdirs": "wheel",
"attrs": "wheel",
"babel": "wheel",
"beautifulsoup4": "wheel",
"cached-property": "wheel",
"certifi": "wheel",
"cffi": "wheel",
"chardet": "wheel",
"cryptography": "wheel",
"decorator": "wheel",
"defusedxml": "wheel",
"docutils": "wheel",
"ebaysdk": "2.1.5",
"freezegun": "wheel",
"gevent": "21.8.0",
"greenlet": "wheel",
"idna": "wheel",
"isodate": "wheel",
"jinja2": "wheel",
"libsass": "0.18.0",
"lxml": "wheel",
"markupsafe": "1.1.0",
"num2words": "wheel",
"ofxparse": "0.21",
"passlib": "wheel",
"pillow": "wheel",
"polib": "wheel",
"psutil": "5.6.7",
"psycopg2": "2.8.6",
"pyasn1": "wheel",
"pyasn1-modules": "wheel",
"pycparser": "wheel",
"pydot": "wheel",
"pyopenssl": "wheel",
"pyparsing": "wheel",
"pypdf2": "1.26.0",
"pyserial": "wheel",
"python-dateutil": "wheel",
"python-ldap": "3.4.0",
"python-stdnum": "wheel",
"pytz": "wheel",
"pyusb": "1.0.2",
"qrcode": "wheel",
"reportlab": "3.5.59",
"requests": "wheel",
"requests-toolbelt": "wheel",
"setuptools": "wheel",
"six": "wheel",
"soupsieve": "wheel",
"urllib3": "wheel",
"vobject": "0.9.6.1",
"werkzeug": "wheel",
"xlrd": "wheel",
"xlsxwriter": "wheel",
"xlwt": "wheel",
"zeep": "wheel",
"zope-event": "wheel",
"zope-interface": "wheel"
}
}
},
"invalidationHash": "276a5b2e68093db0ec674ca946d0cc87e76247d30c7c78cab50071dfbb816942"
"invalidationHash": "8cba86630b33c4917536e287be19213b7ce0f33df9b11107111f95bb7862b530"
}

View File

@ -26,7 +26,7 @@ in {
hash = "sha256-ZlPH+RaRZbWooe+kpiFYZtvuVmXtOMHeCW+Z74ZscXY=";
};
pythonSources = config.deps.fetchPythonRequirements {
mach-nix.pythonSources = config.deps.fetchPythonRequirements {
inherit (config.deps) python;
name = config.pname;
requirementsFiles = ["${config.src}/requirements.txt"];
@ -39,13 +39,13 @@ in {
# Replace some python packages entirely with candidates from nixpkgs, because
# they are hard to fix
substitutions = {
mach-nix.substitutions = {
python-ldap = python.pkgs.python-ldap;
pillow = python.pkgs.pillow;
};
# fix some builds via overrides
overrides = {
mach-nix.overrides = {
libsass = old: {
doCheck = false;
};
@ -54,7 +54,7 @@ in {
};
};
manualSetupDeps.libsass = [
mach-nix.manualSetupDeps.libsass = [
"six"
];
}

View File

@ -1,48 +1,50 @@
{
"content": {
"mach-nix-dists": {
"absl-py": "wheel",
"astunparse": "wheel",
"cachetools": "wheel",
"certifi": "wheel",
"charset-normalizer": "wheel",
"flatbuffers": "wheel",
"gast": "wheel",
"google-auth": "wheel",
"google-auth_oauthlib": "wheel",
"google-pasta": "wheel",
"grpcio": "wheel",
"h5py": "wheel",
"idna": "wheel",
"keras": "wheel",
"libclang": "wheel",
"markdown": "wheel",
"markupsafe": "wheel",
"numpy": "wheel",
"oauthlib": "wheel",
"opt-einsum": "wheel",
"packaging": "wheel",
"protobuf": "wheel",
"pyasn1": "wheel",
"pyasn1-modules": "wheel",
"requests": "wheel",
"requests-oauthlib": "wheel",
"rsa": "wheel",
"setuptools": "wheel",
"six": "wheel",
"tensorboard": "wheel",
"tensorboard-data_server": "wheel",
"tensorboard-plugin_wit": "wheel",
"tensorflow": "wheel",
"tensorflow-estimator": "wheel",
"tensorflow-io_gcs_filesystem": "wheel",
"termcolor": "wheel",
"typing-extensions": "wheel",
"urllib3": "wheel",
"werkzeug": "wheel",
"wheel": "wheel",
"wrapt": "wheel"
"mach-nix": {
"dists": {
"absl-py": "wheel",
"astunparse": "wheel",
"cachetools": "wheel",
"certifi": "wheel",
"charset-normalizer": "wheel",
"flatbuffers": "wheel",
"gast": "wheel",
"google-auth": "wheel",
"google-auth_oauthlib": "wheel",
"google-pasta": "wheel",
"grpcio": "wheel",
"h5py": "wheel",
"idna": "wheel",
"keras": "wheel",
"libclang": "wheel",
"markdown": "wheel",
"markupsafe": "wheel",
"numpy": "wheel",
"oauthlib": "wheel",
"opt-einsum": "wheel",
"packaging": "wheel",
"protobuf": "wheel",
"pyasn1": "wheel",
"pyasn1-modules": "wheel",
"requests": "wheel",
"requests-oauthlib": "wheel",
"rsa": "wheel",
"setuptools": "wheel",
"six": "wheel",
"tensorboard": "wheel",
"tensorboard-data_server": "wheel",
"tensorboard-plugin_wit": "wheel",
"tensorflow": "wheel",
"tensorflow-estimator": "wheel",
"tensorflow-io_gcs_filesystem": "wheel",
"termcolor": "wheel",
"typing-extensions": "wheel",
"urllib3": "wheel",
"werkzeug": "wheel",
"wheel": "wheel",
"wrapt": "wheel"
}
}
},
"invalidationHash": "1f0699b3c13c8c7d3c11da48f2eb08a003dc30fa4ccafdc515cec3315d53fa49"
"invalidationHash": "be615f13c79e520c97aef008baf52d6dc25132e91b81c4a9346afd4994df462d"
}

View File

@ -25,10 +25,10 @@ in {
];
preUnpack = ''
export src=$(ls ${config.pythonSources}/names/${config.pname}/*);
export src=$(ls ${config.mach-nix.pythonSources}/names/${config.pname}/*);
'';
pythonSources = config.deps.fetchPythonRequirements {
mach-nix.pythonSources = config.deps.fetchPythonRequirements {
inherit (config.deps) python;
name = config.pname;
requirementsList = ["${config.pname}==${config.version}"];