2
0
Fork 0
genodepkgs/lib/default.nix

37 lines
1.0 KiB
Nix
Raw Normal View History

2020-01-17 01:24:34 +01:00
# SPDX-License-Identifier: CC0-1.0
2020-03-27 08:05:41 +01:00
{ system, localSystem, crossSystem, genodepkgs, nixpkgs, apps }:
2019-11-10 09:42:12 +01:00
let
2020-01-14 12:16:02 +01:00
thisSystem = builtins.getAttr system;
hostPkgs = nixpkgs.legacyPackages.${localSystem};
2019-12-02 16:39:52 +01:00
testPkgs = thisSystem genodepkgs.packages;
2019-11-10 09:42:12 +01:00
in {
dhallText = name: source:
hostPkgs.runCommand name {
inherit name source;
preferLocalBuild = true;
buildInputs = [ hostPkgs.dhall ];
DHALL_PRELUDE = "${testPkgs.dhallPackages.prelude}/package.dhall";
DHALL_GENODE = "${testPkgs.dhallPackages.genode}/package.dhall";
} ''
export XDG_CACHE_HOME=$NIX_BUILD_TOP
dhall text < $source > $out
'';
mergeManifests = inputs:
nixpkgs.writeTextFile {
name = "manifest.dhall";
text = with builtins;
let
f = head: input:
if hasAttr "manifest" input then
"${head},${input.pname}=${input.manifest}"
else
abort "${input.pname} does not have a manifest";
in (foldl' f "{" inputs) + "}";
};
2019-11-10 09:42:12 +01:00
}