flake.nix: Use a Nixpkgs scope for components

This commit is contained in:
Robert Hensing 2024-06-26 02:38:07 +02:00
parent a92f3071bb
commit a14faa869d
2 changed files with 96 additions and 87 deletions

View file

@ -172,93 +172,16 @@
}; };
}); });
# TODO: define everything here instead of top level? # A new scope, so that we can use `callPackage` to inject our own interdependencies
nix-components = { # without "polluting" the top level "`pkgs`" attrset.
inherit (final) # This also has the benefit of providing us with a distinct set of packages
nix-util # we can iterate over.
nix-util-test-support nixComponents = lib.makeScope final.newScope (import ./packaging/components.nix {
nix-util-test pkgs = final;
nix-util-c inherit stdenv versionSuffix officialRelease;
nix-store });
nix-fetchers
nix-perl-bindings
;
};
nix-util = final.callPackage ./src/libutil/package.nix { nix = final.nixComponents.nix;
inherit
fileset
stdenv
officialRelease
versionSuffix
;
};
nix-util-test-support = final.callPackage ./tests/unit/libutil-support/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-util-test = final.callPackage ./tests/unit/libutil/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-util-c = final.callPackage ./src/libutil-c/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-store = final.callPackage ./src/libstore/package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
libseccomp = final.libseccomp-nix;
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;
};
nix-fetchers = final.callPackage ./src/libfetchers/package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
};
nix =
final.callPackage ./package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
boehmgc = final.boehmgc-nix;
libgit2 = final.libgit2-nix;
libseccomp = final.libseccomp-nix;
busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell;
};
nix-perl-bindings = final.callPackage ./src/perl/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-internal-api-docs = final.callPackage ./src/internal-api-docs/package.nix { nix-internal-api-docs = final.callPackage ./src/internal-api-docs/package.nix {
inherit inherit
@ -340,7 +263,7 @@
"static-" = nixpkgsFor.${system}.static; "static-" = nixpkgsFor.${system}.static;
}) })
(nixpkgsPrefix: nixpkgs: (nixpkgsPrefix: nixpkgs:
flatMapAttrs nixpkgs.nix-components flatMapAttrs nixpkgs.nixComponents
(pkgName: pkg: (pkgName: pkg:
flatMapAttrs pkg.tests or {} flatMapAttrs pkg.tests or {}
(testName: test: { (testName: test: {

86
packaging/components.nix Normal file
View file

@ -0,0 +1,86 @@
{pkgs, stdenv, officialRelease, versionSuffix}: scope:
let
inherit (scope) callPackage;
# TODO: push fileset parameter into package.nix files as `lib` parameter
inherit (callPackage (args@{ lib }: args) {}) lib;
inherit (lib) fileset;
in
# This becomes the pkgs.nixComponents attribute set
{
# TODO: build the nix CLI with meson
nix = pkgs.callPackage ../package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
boehmgc = pkgs.boehmgc-nix;
libgit2 = pkgs.libgit2-nix;
libseccomp = pkgs.libseccomp-nix;
busybox-sandbox-shell = pkgs.busybox-sandbox-shell or pkgs.default-busybox-sandbox-shell;
};
nix-util = callPackage ../src/libutil/package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
};
nix-util-test-support = callPackage ../tests/unit/libutil-support/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-util-test = callPackage ../tests/unit/libutil/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-util-c = callPackage ../src/libutil-c/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
nix-store = callPackage ../src/libstore/package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
libseccomp = pkgs.libseccomp-nix;
busybox-sandbox-shell = pkgs.busybox-sandbox-shell or pkgs.default-busybox-sandbox-shell;
};
nix-fetchers = callPackage ../src/libfetchers/package.nix {
inherit
fileset
stdenv
officialRelease
versionSuffix
;
};
nix-perl-bindings = callPackage ../src/perl/package.nix {
inherit
fileset
stdenv
versionSuffix
;
};
}