mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Add mkMesonPackage for local meson packages
This helper makes it easy to use filesets that include files from parent directories, which we'll need more of in https://github.com/NixOS/nix/pull/10973
This commit is contained in:
parent
5a16bf86c5
commit
e084316130
1 changed files with 29 additions and 0 deletions
|
@ -10,6 +10,33 @@
|
|||
stdenv,
|
||||
versionSuffix,
|
||||
}:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
|
||||
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
|
||||
# serialized by mkDerivation, which doesn't work for this.
|
||||
prevAttrs.workDir;
|
||||
|
||||
workDirSubpath = lib.path.removePrefix root workDirPath;
|
||||
sources = assert prevAttrs.fileset._type == "fileset"; prevAttrs.fileset;
|
||||
src = lib.fileset.toSource { fileset = sources; inherit root; };
|
||||
|
||||
in
|
||||
{
|
||||
sourceRoot = "${src.name}/" + workDirSubpath;
|
||||
inherit src;
|
||||
|
||||
# Clear what `derivation` can't/shouldn't serialize; see prevAttrs.workDir.
|
||||
fileset = null;
|
||||
workDir = null;
|
||||
};
|
||||
|
||||
in
|
||||
scope: {
|
||||
inherit stdenv versionSuffix;
|
||||
|
||||
|
@ -55,4 +82,6 @@ scope: {
|
|||
CONFIG_ASH_TEST y
|
||||
'';
|
||||
});
|
||||
|
||||
mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue