Add manifests to genodelabs repo packages

This commit is contained in:
Ehmry - 2020-01-15 19:28:18 +01:00
parent dee1ae53e6
commit 5a8beaebba
2 changed files with 46 additions and 3 deletions

View File

@ -21,7 +21,8 @@
inherit system nixpkgs;
depot = thisSystem genode-depot.packages;
genode = thisSystem genode.packages;
} // thisSystem genode.packages;
dhallApps = dhall-haskell.apps.${localSystem};
};
legacyPackages = thisSystem nixpkgs.legacyPackages;
# pass thru Nixpkgs

View File

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ system, nixpkgs, depot, genode }:
{ system, nixpkgs, depot, genode, dhallApps }:
let
toolchainOverlay = import ./toolchain-overlay;
@ -13,6 +13,48 @@ let
inherit (super) callPackage;
dhallPackages = super.dhallPackages // (callPackage ./dhall { });
genode' = with builtins;
let
mkDhallManifest = drv:
super.runCommand "${drv.name}.dhall" {
inherit drv;
dhall = dhallApps.dhall.program;
} ''
echo '{' >> manifest.tmp
if [ -d $drv/bin ]; then
echo ', bin = {' >> manifest.tmp
find $drv/bin/ -type f -printf '%f "%p"\n' \
| awk '{print ", "gensub(/\..*/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
echo '}' >> manifest.tmp
fi
if [ -d $drv/lib ]; then
echo ', lib = {' >> manifest.tmp
find $drv/lib/ -type f -name '*.lib.so' -printf '%f "%p"\n' \
| awk '{print ", "gensub(/\..*/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
echo '}' >> manifest.tmp
fi
if [ -d $drv/tar ]; then
echo ', tar = {' >> manifest.tmp
find $drv/tar/ -type f -name '*.tar' -printf '%f "%p"\n' \
| awk '{print ""gensub(/\..*/, "", 1, $1)" = { mapKey = \""$1"\", mapValue = "$2" }" }'>> manifest.tmp
echo '}' >> manifest.tmp
fi
echo '}' >> manifest.tmp
$dhall < manifest.tmp > $out
'';
genodeRepoNames = attrNames genode;
f = name:
let drv = getAttr name genode;
in {
inherit name;
value = drv // { manifest = mkDhallManifest drv; };
};
list = map f genodeRepoNames;
attrs = listToAttrs list;
in attrs;
in rec {
inherit (super) stdenv;
dhallGenode = dhallPackages.genode;
@ -21,4 +63,4 @@ in rec {
nic_bus = callPackage ./pkgs/nic_bus { inherit (genode) base os; };
solo5 = callPackage ./pkgs/solo5 { inherit (genode) base os; };
stdcxx = callPackage ./pkgs/stdcxx { };
}
} // genode'