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

Indirections for packaging meson-based granular build for Nixpkgs #11055

Merged
merged 2 commits into from
Jul 7, 2024
Merged
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
12 changes: 11 additions & 1 deletion packaging/dependencies.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
let
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:
let
root = ../.;
workDirPath =
# Ideally we'd pick finalAttrs.workDir, but for now `mkDerivation` has
# the requirement that everything except passthru and meta must be
Expand All @@ -40,6 +47,7 @@ let
in
scope: {
inherit stdenv versionSuffix;
version = lib.fileContents ../.version + versionSuffix;

libseccomp = pkgs.libseccomp.overrideAttrs (_: rec {
version = "2.5.5";
Expand Down Expand Up @@ -103,5 +111,7 @@ scope: {
meta.platforms = lib.platforms.all;
});

inherit resolvePath filesetToSource;

mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
}
4 changes: 2 additions & 2 deletions src/external-api-docs/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
Expand All @@ -16,7 +16,7 @@ in

mkMesonDerivation (finalAttrs: {
pname = "nix-external-api-docs";
version = lib.fileContents ./.version + versionSuffix;
inherit version;

workDir = ./.;
fileset =
Expand Down
4 changes: 2 additions & 2 deletions src/internal-api-docs/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
Expand All @@ -16,7 +16,7 @@ in

mkMesonDerivation (finalAttrs: {
pname = "nix-internal-api-docs";
version = lib.fileContents ./.version + versionSuffix;
inherit version;

workDir = ./.;
fileset = let
Expand Down
4 changes: 1 addition & 3 deletions src/libcmd/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Configuration Options

, versionSuffix ? ""
, version

# Whether to enable Markdown rendering in the Nix binary.
, enableMarkdown ? !stdenv.hostPlatform.isWindows
Expand All @@ -36,8 +36,6 @@

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libexpr-c/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libexpr/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# Configuration Options

, versionSuffix ? ""
, version

# Whether to use garbage collection for the Nix language evaluator.
#
Expand All @@ -36,8 +36,6 @@

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libfetchers/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libflake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libmain/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libstore-c/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libstore/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@

# Configuration Options

, versionSuffix ? ""
, version

, embeddedSandboxShell ? stdenv.hostPlatform.isStatic
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libutil-c/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 1 addition & 3 deletions src/libutil/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
4 changes: 2 additions & 2 deletions src/perl/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
, pkg-config
, nix-store
, darwin
, versionSuffix ? ""
, version
, curl
, bzip2
, libsodium
Expand All @@ -20,7 +20,7 @@ in

perl.pkgs.toPerlModule (mkMesonDerivation (finalAttrs: {
pname = "nix-perl";
version = lib.fileContents ./.version + versionSuffix;
inherit version;

workDir = ./.;
fileset = fileset.unions ([
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/libexpr-support/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/libexpr/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@

# Configuration Options

, versionSuffix ? ""
, version
, resolvePath
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down Expand Up @@ -86,7 +85,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-expr-tests
touch $out
'';
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/libfetchers/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

# Configuration Options

, versionSuffix ? ""
, version
, resolvePath
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down Expand Up @@ -84,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-fetchers-tests
touch $out
'';
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/libflake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@

# Configuration Options

, versionSuffix ? ""
, version
, resolvePath
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down Expand Up @@ -84,7 +83,7 @@ mkMesonDerivation (finalAttrs: {
run = runCommand "${finalAttrs.pname}-run" {
} ''
PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH"
export _NIX_TEST_UNIT_DATA=${./data}
export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
nix-flake-tests
touch $out
'';
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/libstore-support/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/libstore/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@

# Configuration Options

, versionSuffix ? ""
, version
, filesetToSource
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down Expand Up @@ -88,7 +87,7 @@ mkMesonDerivation (finalAttrs: {
run = let
# Some data is shared with the functional tests: they create it,
# we consume it.
data = lib.fileset.toSource {
data = filesetToSource {
root = ../..;
fileset = lib.fileset.unions [
./data
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/libutil-support/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@

# Configuration Options

, versionSuffix ? ""
, version
}:

let
inherit (lib) fileset;

version = lib.fileContents ./.version + versionSuffix;
in

mkMesonDerivation (finalAttrs: {
Expand Down
Loading
Loading