zephyr: Put modules in a subdirectory so zephyr doesn't get mad

This commit is contained in:
Artemis Tosini 2023-11-13 06:48:03 +00:00
parent 8483d4813a
commit 453af715ee
Signed by: artemist
GPG key ID: EE5227935FE3FF18
3 changed files with 21 additions and 2 deletions

View file

@ -2,6 +2,7 @@
let
assets = lib.importJSON ./assets.json;
modules = lib.importJSON ./modules.json;
buildModule = module: callPackage ./module.nix { inherit module; };
in {
host-tools = callPackage ./host-tools.nix {
inherit (assets) version hosts;
@ -20,5 +21,5 @@ in {
};
src = fetchFromGitHub modules.zephyr;
modules = lib.mapAttrs (_: fetchFromGitHub) modules.modules;
modules = lib.mapAttrs (_: buildModule) modules.modules;
}

View file

@ -0,0 +1,17 @@
{ stdenvNoCC, fetchFromGitHub, version ? null, module }:
let src = fetchFromGitHub module;
in stdenvNoCC.mkDerivation (finalAttrs: {
name = if version != null then
"${module.name}-wrapped-${version}"
else
"${module.name}-wrapped";
passthru.modulePath = "${finalAttrs.finalPackage.out}/${module.name}";
passAsFile = [ "buildCommand" ];
buildCommand = ''
mkdir -p $out
ln -s "${src}" "$out/${module.name}"
'';
})

View file

@ -29,5 +29,6 @@ in mkShell ({
PATH="${zephyrSrc}/scripts:$PATH"
'';
} // lib.optionalAttrs (modules != [ ]) {
ZEPHYR_MODULES = lib.concatStringsSep ";" (map (pkg: pkg.out) modules);
ZEPHYR_MODULES =
lib.concatStringsSep ";" (map (pkg: pkg.passthru.modulePath) modules);
} // extraAttrs)