From 4aa6e86907be49aa3fad3c912e791e7e638d3c1a Mon Sep 17 00:00:00 2001 From: DavHau Date: Sun, 19 Mar 2023 14:46:59 +0700 Subject: [PATCH] chore(v1): move name & version to top-level --- v1/nix/modules/drv-parts/eval-cache/default.nix | 4 ++-- v1/nix/modules/drv-parts/mach-nix-xs/default.nix | 7 +++---- .../drv-parts/nixpkgs-overrides/default.nix | 2 +- v1/nix/modules/drvs/ansible/default.nix | 14 ++++++-------- v1/nix/modules/drvs/apache-airflow/default.nix | 10 ++++------ v1/nix/modules/drvs/odoo/default.nix | 8 +++----- v1/nix/modules/drvs/pillow/default.nix | 12 +++++------- v1/nix/modules/drvs/tensorflow/default.nix | 14 ++++++-------- v1/nix/modules/flake-parts/packages.nix | 2 +- 9 files changed, 31 insertions(+), 42 deletions(-) diff --git a/v1/nix/modules/drv-parts/eval-cache/default.nix b/v1/nix/modules/drv-parts/eval-cache/default.nix index e36d555d..6f4f8f49 100644 --- a/v1/nix/modules/drv-parts/eval-cache/default.nix +++ b/v1/nix/modules/drv-parts/eval-cache/default.nix @@ -6,7 +6,7 @@ l = lib // builtins; cfg = config.eval-cache; - packageName = config.public.name; + packageName = config.name; filterTrue = l.filterAttrsRecursive (key: val: l.isAttrs val || val == true); @@ -106,7 +106,7 @@ ; refresh = config.deps.writeScript - "refresh-${config.public.name}" + "refresh-${config.name}" refreshCommand; }; diff --git a/v1/nix/modules/drv-parts/mach-nix-xs/default.nix b/v1/nix/modules/drv-parts/mach-nix-xs/default.nix index 8ce51782..98062c9e 100644 --- a/v1/nix/modules/drv-parts/mach-nix-xs/default.nix +++ b/v1/nix/modules/drv-parts/mach-nix-xs/default.nix @@ -7,7 +7,7 @@ l = lib // builtins; python = config.deps.python; cfg = config.mach-nix; - packageName = config.public.name; + packageName = config.name; # For a given name, return the path containing the downloaded file getDistDir = name: "${cfg.pythonSources.names}/${name}"; @@ -109,9 +109,8 @@ ; }; - public = { - inherit name version; - }; + inherit name version; + buildPythonPackage = { format = "setuptools"; pipInstallFlags = diff --git a/v1/nix/modules/drv-parts/nixpkgs-overrides/default.nix b/v1/nix/modules/drv-parts/nixpkgs-overrides/default.nix index 280d0d8e..02f295ea 100644 --- a/v1/nix/modules/drv-parts/nixpkgs-overrides/default.nix +++ b/v1/nix/modules/drv-parts/nixpkgs-overrides/default.nix @@ -19,7 +19,7 @@ in l.filterAttrs (name: _: ! excludedNixpkgsAttrs ? ${name}) pythonAttrs; - extracted = extractPythonAttrs config.deps.python.pkgs.${config.public.name}; + extracted = extractPythonAttrs config.deps.python.pkgs.${config.name}; in { imports = [ ./interface.nix diff --git a/v1/nix/modules/drvs/ansible/default.nix b/v1/nix/modules/drvs/ansible/default.nix index d97bf76f..8abf2e56 100644 --- a/v1/nix/modules/drvs/ansible/default.nix +++ b/v1/nix/modules/drvs/ansible/default.nix @@ -14,14 +14,12 @@ in { python = nixpkgs.python39; }; - public = { - name = "ansible"; - version = "2.7.1"; - }; + name = "ansible"; + version = "2.7.1"; mkDerivation = { preUnpack = '' - export src=$(ls ${config.mach-nix.pythonSources}/names/${config.public.name}/*); + export src=$(ls ${config.mach-nix.pythonSources}/names/${config.name}/*); ''; }; @@ -29,14 +27,14 @@ in { format = "setuptools"; pythonImportsCheck = [ - config.public.name + config.name ]; }; mach-nix.pythonSources = config.deps.fetchPythonRequirements { inherit python; - name = config.public.name; - requirementsList = ["${config.public.name}==${config.public.version}"]; + name = config.name; + requirementsList = ["${config.name}==${config.version}"]; hash = "sha256-dCo1llHcCiFrBOEd6mWhwqwVglsN2grSbcdBj8OzKDY="; maxDate = "2023-01-01"; }; diff --git a/v1/nix/modules/drvs/apache-airflow/default.nix b/v1/nix/modules/drvs/apache-airflow/default.nix index 08ef2644..9a12c061 100644 --- a/v1/nix/modules/drvs/apache-airflow/default.nix +++ b/v1/nix/modules/drvs/apache-airflow/default.nix @@ -26,16 +26,14 @@ in { ; }; - public = { - name = "apache-airflow"; - version = "2.5.0"; - }; + name = "apache-airflow"; + version = "2.5.0"; mkDerivation = { src = config.deps.fetchFromGitHub { owner = "apache"; repo = "airflow"; - rev = "refs/tags/${config.public.version}"; + rev = "refs/tags/${config.version}"; # Download using the git protocol rather than using tarballs, because the # GitHub archive tarballs don't appear to include tests forceFetchGit = true; @@ -58,7 +56,7 @@ in { mach-nix.pythonSources = config.deps.fetchPythonRequirements { inherit (config.deps) python; - name = config.public.name; + name = config.name; requirementsList = [ "apache-airflow" ]; diff --git a/v1/nix/modules/drvs/odoo/default.nix b/v1/nix/modules/drvs/odoo/default.nix index 4e1dac6f..232554d8 100644 --- a/v1/nix/modules/drvs/odoo/default.nix +++ b/v1/nix/modules/drvs/odoo/default.nix @@ -19,10 +19,8 @@ in { python = nixpkgs.python38; }; - public = { - name = "odoo"; - version = "16.0"; - }; + name = "odoo"; + version = "16.0"; mkDerivation = { src = config.deps.fetchFromGitHub { @@ -36,7 +34,7 @@ in { mach-nix.pythonSources = config.deps.fetchPythonRequirements { inherit (config.deps) python; - name = config.public.name; + name = config.name; requirementsFiles = ["${config.mkDerivation.src}/requirements.txt"]; hash = "sha256-E9wNvBakm+R5TSsFsnGpSaziYpi2otm0iBiyphUVSFI="; maxDate = "2023-01-01"; diff --git a/v1/nix/modules/drvs/pillow/default.nix b/v1/nix/modules/drvs/pillow/default.nix index 7bd2141c..1d03ddc1 100644 --- a/v1/nix/modules/drvs/pillow/default.nix +++ b/v1/nix/modules/drvs/pillow/default.nix @@ -22,10 +22,8 @@ in { ; }; - public = { - name = "pillow"; - version = "9.3.0"; - }; + name = "pillow"; + version = "9.3.0"; mkDerivation = { nativeBuildInputs = [ @@ -37,7 +35,7 @@ in { ]; preUnpack = '' - export src=$(ls ${config.mach-nix.pythonSources}/names/${config.public.name}/*); + export src=$(ls ${config.mach-nix.pythonSources}/names/${config.name}/*); ''; }; @@ -51,8 +49,8 @@ in { mach-nix.pythonSources = config.deps.fetchPythonRequirements { inherit python; - name = config.public.name; - requirementsList = ["${config.public.name}==${config.public.version}"]; + name = config.name; + requirementsList = ["${config.name}==${config.version}"]; hash = "sha256-eS81pqSjU6mgBL6tXadSxkGdafsVFThByOQcOf8FkF0="; maxDate = "2023-01-01"; pipFlags = [ diff --git a/v1/nix/modules/drvs/tensorflow/default.nix b/v1/nix/modules/drvs/tensorflow/default.nix index 3b970976..9a52d07f 100644 --- a/v1/nix/modules/drvs/tensorflow/default.nix +++ b/v1/nix/modules/drvs/tensorflow/default.nix @@ -18,28 +18,26 @@ in { ; }; - public = { - name = "tensorflow"; - version = "2.11.0"; - }; + name = "tensorflow"; + version = "2.11.0"; mkDerivation = { preUnpack = '' - export src=$(ls ${config.mach-nix.pythonSources}/names/${config.public.name}/*); + export src=$(ls ${config.mach-nix.pythonSources}/names/${config.name}/*); ''; }; buildPythonPackage = { format = "wheel"; pythonImportsCheck = [ - config.public.name + config.name ]; }; mach-nix.pythonSources = config.deps.fetchPythonRequirements { inherit (config.deps) python; - name = config.public.name; - requirementsList = ["${config.public.name}==${config.public.version}"]; + name = config.name; + requirementsList = ["${config.name}==${config.version}"]; hash = "sha256-PDUrECFjoPznqXwqi2e1djx63t+kn/kAyM9JqQrTmd0="; maxDate = "2023-01-01"; }; diff --git a/v1/nix/modules/flake-parts/packages.nix b/v1/nix/modules/flake-parts/packages.nix index 6031a643..6dafe3e7 100644 --- a/v1/nix/modules/flake-parts/packages.nix +++ b/v1/nix/modules/flake-parts/packages.nix @@ -8,7 +8,7 @@ system = "x86_64-linux"; # A module imported into every package setting up the eval cache evalCacheSetup = {config, ...}: { - eval-cache.cacheFileRel = "/v1/nix/modules/drvs/${config.public.name}/cache-${system}.json"; + eval-cache.cacheFileRel = "/v1/nix/modules/drvs/${config.name}/cache-${system}.json"; eval-cache.repoRoot = self; eval-cache.enable = true; };