From 3a0d86412351ad50a34dcef5cf2be21d8e1060f7 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 22:21:20 +0300 Subject: [PATCH 1/3] doc/by-name: explain motivation for transition when custom args are used --- pkgs/by-name/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/README.md b/pkgs/by-name/README.md index 61496fcfc48d6..b337c8c783011 100644 --- a/pkgs/by-name/README.md +++ b/pkgs/by-name/README.md @@ -92,7 +92,7 @@ though this is not required and must not be expected. Note that definitions in `all-packages.nix` with custom arguments should not be removed. That is a backwards-incompatible change because it changes the `.override` interface. -Such packages may still be moved to `pkgs/by-name` however, while keeping the definition in `all-packages.nix`. +Such packages may still be moved to `pkgs/by-name` however, in order to avoid the slightly superficial choice of directory / category in which the `default.nix` file was placed, but please keep the definition in `all-packages.nix` using `callPackage`. See also [changing implicit attribute defaults](#changing-implicit-attribute-defaults). ## Limitations From 52b55691c1c4a3af302b8ee30d6b24aa5c33fd3c Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 22:28:33 +0300 Subject: [PATCH 2/3] doc/by-name: explain better `callPackage` and `xWithY=x.override` transition --- pkgs/by-name/README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/README.md b/pkgs/by-name/README.md index b337c8c783011..5eb121b4f3f05 100644 --- a/pkgs/by-name/README.md +++ b/pkgs/by-name/README.md @@ -90,11 +90,29 @@ if package maintainers would like to use this feature, they are welcome to migra To lessen PR traffic, they're encouraged to also perform some more general maintenance on the package in the same PR, though this is not required and must not be expected. -Note that definitions in `all-packages.nix` with custom arguments should not be removed. +Note that `callPackage` definitions in `all-packages.nix` with custom arguments should not be removed. That is a backwards-incompatible change because it changes the `.override` interface. Such packages may still be moved to `pkgs/by-name` however, in order to avoid the slightly superficial choice of directory / category in which the `default.nix` file was placed, but please keep the definition in `all-packages.nix` using `callPackage`. See also [changing implicit attribute defaults](#changing-implicit-attribute-defaults). +Definitions like the following however, _can_ be transitioned: + +```nix +# all-packages.nix +fooWithBaz = foo.override { + bar = baz; +}; +# turned into pkgs/by-name/fo/fooWithBaz/package.nix with: +{ + foo, + baz, +}: + +foo.override { + bar = baz; +} +``` + ## Limitations There's some limitations as to which packages can be defined using this structure: From c50e93897fb04c1980249ddbcbd7f9654663f711 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 16:20:59 +0300 Subject: [PATCH 3/3] lammps-mpi: move to pkgs/by-name --- pkgs/by-name/la/lammps-mpi/package.nix | 13 +++++++++++++ pkgs/top-level/all-packages.nix | 6 ------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 pkgs/by-name/la/lammps-mpi/package.nix diff --git a/pkgs/by-name/la/lammps-mpi/package.nix b/pkgs/by-name/la/lammps-mpi/package.nix new file mode 100644 index 0000000000000..1ac2e6a8bcb22 --- /dev/null +++ b/pkgs/by-name/la/lammps-mpi/package.nix @@ -0,0 +1,13 @@ +{ + lammps, + mpi, + lowPrio, +}: + +lowPrio ( + lammps.override { + extraBuildInputs = [ + mpi + ]; + } +) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ea232b3626144..1638670bdea0b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -36556,12 +36556,6 @@ with pkgs; dl-poly-classic-mpi = callPackage ../applications/science/molecular-dynamics/dl-poly-classic { }; - lammps-mpi = lowPrio (lammps.override { - extraBuildInputs = [ - mpi - ]; - }); - gromacs = callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = true; fftw = fftwSinglePrec;