1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-12 19:05:08 +02:00

packaging: Various improvements

Co-authored-by: Mic92 <Mic92@users.noreply.github.com>
This commit is contained in:
Robert Hensing 2025-03-31 15:16:17 +02:00 committed by Jörg Thalheim
parent c57e2486df
commit 1172e49a3a
3 changed files with 93 additions and 50 deletions

View file

@ -4,6 +4,8 @@
lndir,
buildEnv,
maintainers,
nix-util,
nix-util-c,
nix-util-tests,
@ -39,6 +41,8 @@
nix-perl-bindings,
testers,
patchedSrc ? null,
}:
let
@ -68,48 +72,6 @@ let
;
};
dev = stdenv.mkDerivation (finalAttrs: {
name = "nix-${nix-cli.version}-dev";
pname = "nix";
version = nix-cli.version;
dontUnpack = true;
dontBuild = true;
libs = map lib.getDev (lib.attrValues libs);
installPhase = ''
mkdir -p $out/nix-support
echo $libs >> $out/nix-support/propagated-build-inputs
'';
passthru = {
tests = {
pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage;
};
};
# If we were to fully emulate output selection here, we'd confuse the Nix CLIs,
# because they rely on `drvPath`.
dev = finalAttrs.finalPackage.out;
libs = throw "`nix.dev.libs` is not meant to be used; use `nix.libs` instead.";
};
meta = {
mainProgram = "nix";
pkgConfigModules = [
"nix-cmd"
"nix-expr"
"nix-expr-c"
"nix-fetchers"
"nix-flake"
"nix-flake-c"
"nix-main"
"nix-main-c"
"nix-store"
"nix-store-c"
"nix-util"
"nix-util-c"
];
};
});
devdoc = buildEnv {
name = "nix-${nix-cli.version}-devdoc";
paths = [
@ -192,10 +154,15 @@ stdenv.mkDerivation (finalAttrs: {
devPaths = lib.mapAttrsToList (_k: lib.getDev) finalAttrs.finalPackage.libs;
in
''
mkdir -p $out $dev
mkdir -p $out $dev/nix-support
# Custom files
echo $libs >> $dev/nix-support/propagated-build-inputs
echo ${nix-cli} ${lib.escapeShellArgs devPaths} >> $dev/nix-support/propagated-build-inputs
# Merged outputs
lndir ${nix-cli} $out
for lib in ${lib.escapeShellArgs devPaths}; do
lndir $lib $dev
done
@ -207,6 +174,7 @@ stdenv.mkDerivation (finalAttrs: {
passthru = {
inherit (nix-cli) version;
src = patchedSrc;
/**
These are the libraries that are part of the Nix project. They are used
@ -248,7 +216,29 @@ stdenv.mkDerivation (finalAttrs: {
meta = {
mainProgram = "nix";
description = "The Nix package manager";
pkgConfigModules = dev.meta.pkgConfigModules;
longDescription = nix-cli.meta.longDescription;
homepage = nix-cli.meta.homepage;
license = nix-cli.meta.license;
maintainers = maintainers;
platforms = nix-cli.meta.platforms;
outputsToInstall = [
"out"
"man"
];
pkgConfigModules = [
"nix-cmd"
"nix-expr"
"nix-expr-c"
"nix-fetchers"
"nix-flake"
"nix-flake-c"
"nix-main"
"nix-main-c"
"nix-store"
"nix-store-c"
"nix-util"
"nix-util-c"
];
};
})