-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all-packages.nix: Provide a shorter way to specify packages
There are zillions of lines of the form foo = callPackage ../bla/foo { }; in all-packages.nix. To get rid of this verbosity, you can now list such packages in pkgs/auto-packages.nix. This is just a list of package file names, e.g. development/libraries/libogg development/libraries/libvorbis tools/archivers/gnutar If the package needs non-default function arguments, or if its intended attribute name is different from its file name, then you cannot put it in auto-packages.nix and instead need to specify it in all-packages.nix. If Nix had a glob function (NixOS/nix#235), we could even get rid of auto-packages.nix and have package expressions be discovered automatically. However, that might not be desirable because of the need to traverse the file system to find packages we may not even use.
- Loading branch information
Showing
2 changed files
with
32 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* A list of file names of package Nix expressions, whose base names | ||
match the intended attribute names, and that do not need to be | ||
called with any overrides. Thus, listing ‘./foo.nix’ here is | ||
equivalent to defining the attribute | ||
foo = callPackage ./foo.nix { }; | ||
in all-packages.nix. */ | ||
|
||
[ | ||
build-support/libredirect | ||
development/libraries/libogg | ||
development/libraries/libvorbis | ||
tools/archivers/gnutar | ||
tools/system/acct | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ece61b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know... I quite utilized the fact that all top-level attributes were easy to find in all-packages.nix, but moving auto-packages into all-packages might be confusing.
ece61b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda weird motivation. If there are packages that "we may not even use" why they are in the git repository in the first place?
Also if nix had glob function the files that are not used may probably be never read, by using lazy evaluation (unless a list of packages is required).
ece61b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not being used meaning "not used by the current evaluation". For instance, a NixOS evaluation typically only accesses a small subset of Nixpkgs.