Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto call generic #6

Open
wants to merge 2 commits into
base: versions-proposal
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,38 @@ let
rev = "c19c816e39d14a60dd368d601aa9b389b09d0bbb";
});

inherit (lib.attrsets) mergeAttrsList mapAttrsToList;

# TODO: Move to nix-lib if generic version proposal succeeds
mkAutoCalledPolyPackageDir = baseDirectory:
let
namesForShard = lib.packageSets.mkNamesForDirectory baseDirectory;
# This is defined up here in order to allow reuse of the value (it's kind of expensive to compute)
# if the overlay has to be applied multiple times
packageFiles = mergeAttrsList (mapAttrsToList namesForShard (builtins.readDir baseDirectory));
in
# TODO: Consider optimising this using `builtins.deepSeq packageFiles`,
# which could free up the above thunks and reduce GC times.
# Currently this would be hard to measure until we have more packages
# and ideally https://github.com/NixOS/nix/pull/8895
self: super:
{
_internalCallPolyFile = file: self.callPackage (import file { inherit (self) mkGenericPkg; }) { };
}
// builtins.mapAttrs
(name: value: self._internalCallPolyFile value)
packageFiles;

polyPkgOverlay = mkAutoCalledPolyPackageDir ./polyPkgs;

pkgsOverlay = lib.mkAutoCalledPackageDir ./pkgs;

toplevelOverlay = import ./top-level.nix;
in

import stdenvRepo {
overlays = [
polyPkgOverlay
pkgsOverlay
toplevelOverlay
];
Expand Down
17 changes: 0 additions & 17 deletions pkgs/openssl/default.nix

This file was deleted.

File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions polyPkgs/openssl/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ mkGenericPkg }:

mkGenericPkg {
versions = ./versions.nix;
aliases = ./aliases.nix;
defaultSelector = (p: p.v3_3);
genericBuilder = ./generic.nix;
}

File renamed without changes.
File renamed without changes.