Merge pull request #11055 from NixOS/packaging-for-nixpkgs

Indirections for packaging meson-based granular build for Nixpkgs
This commit is contained in:
Robert Hensing 2024-07-07 21:33:01 +02:00 committed by GitHub
commit a9592077fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 43 additions and 65 deletions

View file

@ -14,9 +14,16 @@
let let
inherit (pkgs) lib; inherit (pkgs) lib;
root = ../.;
# Nixpkgs implements this by returning a subpath into the fetched Nix sources.
resolvePath = p: p;
# Indirection for Nixpkgs to override when package.nix files are vendored
filesetToSource = lib.fileset.toSource;
localSourceLayer = finalAttrs: prevAttrs: localSourceLayer = finalAttrs: prevAttrs:
let let
root = ../.;
workDirPath = workDirPath =
# Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has # Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has
# the requirement that everything except passthru and meta must be # the requirement that everything except passthru and meta must be
@ -40,6 +47,7 @@ let
in in
scope: { scope: {
inherit stdenv versionSuffix; inherit stdenv versionSuffix;
version = lib.fileContents ../.version + versionSuffix;
libseccomp = pkgs.libseccomp.overrideAttrs (_: rec { libseccomp = pkgs.libseccomp.overrideAttrs (_: rec {
version = "2.5.5"; version = "2.5.5";
@ -103,5 +111,7 @@ scope: {
meta.platforms = lib.platforms.all; meta.platforms = lib.platforms.all;
}); });
inherit resolvePath filesetToSource;
mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f); mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
} }

View file

@ -7,7 +7,7 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
@ -16,7 +16,7 @@ in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
pname = "nix-external-api-docs"; pname = "nix-external-api-docs";
version = lib.fileContents ./.version + versionSuffix; inherit version;
workDir = ./.; workDir = ./.;
fileset = fileset =

View file

@ -7,7 +7,7 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
@ -16,7 +16,7 @@ in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
pname = "nix-internal-api-docs"; pname = "nix-internal-api-docs";
version = lib.fileContents ./.version + versionSuffix; inherit version;
workDir = ./.; workDir = ./.;
fileset = let fileset = let

View file

@ -20,7 +20,7 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
# Whether to enable Markdown rendering in the Nix binary. # Whether to enable Markdown rendering in the Nix binary.
, enableMarkdown ? !stdenv.hostPlatform.isWindows , enableMarkdown ? !stdenv.hostPlatform.isWindows
@ -36,8 +36,6 @@
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -11,13 +11,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -20,7 +20,7 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
# Whether to use garbage collection for the Nix language evaluator. # Whether to use garbage collection for the Nix language evaluator.
# #
@ -36,8 +36,6 @@
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -15,13 +15,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -17,13 +17,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -14,13 +14,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -12,13 +12,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -20,15 +20,13 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, embeddedSandboxShell ? stdenv.hostPlatform.isStatic , embeddedSandboxShell ? stdenv.hostPlatform.isStatic
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -11,13 +11,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -17,13 +17,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -8,7 +8,7 @@
, pkg-config , pkg-config
, nix-store , nix-store
, darwin , darwin
, versionSuffix ? "" , version
, curl , curl
, bzip2 , bzip2
, libsodium , libsodium
@ -20,7 +20,7 @@ in
perl.pkgs.toPerlModule (mkMesonDerivation (finalAttrs: { perl.pkgs.toPerlModule (mkMesonDerivation (finalAttrs: {
pname = "nix-perl"; pname = "nix-perl";
version = lib.fileContents ./.version + versionSuffix; inherit version;
workDir = ./.; workDir = ./.;
fileset = fileset.unions ([ fileset = fileset.unions ([

View file

@ -14,13 +14,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -17,13 +17,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, resolvePath
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -86,7 +85,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" { run = runCommand "${finalAttrs.pname}-run" {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-expr-tests nix-expr-tests
touch $out touch $out
''; '';

View file

@ -16,13 +16,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, resolvePath
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -84,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" { run = runCommand "${finalAttrs.pname}-run" {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-fetchers-tests nix-fetchers-tests
touch $out touch $out
''; '';

View file

@ -16,13 +16,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, resolvePath
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -84,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" { run = runCommand "${finalAttrs.pname}-run" {
} '' } ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data} export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-flake-tests nix-flake-tests
touch $out touch $out
''; '';

View file

@ -14,13 +14,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -18,13 +18,12 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
, filesetToSource
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {
@ -88,7 +87,7 @@ mkMesonDerivation (finalAttrs: {
run = let run = let
# Some data is shared with the functional tests: they create it, # Some data is shared with the functional tests: they create it,
# we consume it. # we consume it.
data = lib.fileset.toSource { data = filesetToSource {
root = ../..; root = ../..;
fileset = lib.fileset.unions [ fileset = lib.fileset.unions [
./data ./data

View file

@ -13,13 +13,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {

View file

@ -17,13 +17,11 @@
# Configuration Options # Configuration Options
, versionSuffix ? "" , version
}: }:
let let
inherit (lib) fileset; inherit (lib) fileset;
version = lib.fileContents ./.version + versionSuffix;
in in
mkMesonDerivation (finalAttrs: { mkMesonDerivation (finalAttrs: {