Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
3.6 KiB

# SPDX-License-Identifier: CC0-1.0
{
edition = 201909;
description = "Genode packages";
inputs = {
2 years ago
genode-depot.uri = "git+https://git.sr.ht/~ehmry/genode-depot";
2 years ago
nixpkgs.uri = "github:ehmry/nixpkgs";
nixpkgsUpstream.uri = "github:NixOS/nixpkgs";
};
outputs = { self, genode-depot, nixpkgs, nixpkgsUpstream }:
let
mkOutput = { system, localSystem, crossSystem }:
let thisSystem = builtins.getAttr system;
in rec {
lib = (nixpkgs.lib) // (import ./lib {
inherit system localSystem crossSystem;
inherit apps nixpkgs genode-depot;
genodepkgs = self;
});
legacyPackages = thisSystem nixpkgs.legacyPackages;
# pass thru Nixpkgs
packages = import ./packages {
inherit system legacyPackages apps;
localPackages = nixpkgsUpstream.legacyPackages.${localSystem};
depot = thisSystem genode-depot.packages;
};
devShell = let
pkgs = nixpkgsUpstream.legacyPackages.x86_64-linux;
fhs = pkgs.buildFHSUserEnv {
name = "genode-env";
targetPkgs = pkgs:
(with pkgs; [
binutils
bison
expect
flex
git
glibc.dev
gnumake
libxml2
qemu
tcl
which
xorriso
]);
runScript = "bash";
extraBuildCommands = let
toolchain = pkgs.fetchzip {
url = "file:///" + packages.genodeSources.toolchain.src;
hash = "sha256-26rPvLUPEJm40zLSqTquwuFTJ1idTB0T4VXgaHRN+4o=";
};
in "ln -s ${toolchain}/local usr/local";
};
in pkgs.stdenv.mkDerivation {
name = "genode-fhs-shell";
nativeBuildInputs = [ fhs ];
shellHook = "exec genode-env";
};
apps = import ./apps {
self = self.apps.${localSystem};
nixpkgs = legacyPackages;
nixpkgsLocal = nixpkgsUpstream.legacyPackages.${localSystem};
inherit packages;
};
checks = import ./tests {
inherit system localSystem crossSystem;
inherit self nixpkgs genode-depot;
inherit apps lib;
genodepkgs = thisSystem self.packages;
};
};
localSystems = [ "x86_64-linux" ];
crossSystems = [ "x86_64-genode" ];
forAllCrossSystems = f:
with builtins;
let
f' = localSystem: crossSystem:
let system = localSystem + "-" + crossSystem;
in {
name = system;
value = f { inherit system localSystem crossSystem; };
};
list = nixpkgs.lib.lists.crossLists f' [ localSystems crossSystems ];
attrSet = listToAttrs list;
in attrSet;
finalize = outputs:
with builtins;
let
outputs' = outputs // {
x86_64-linux = getAttr "x86_64-linux-x86_64-genode" outputs;
};
systems = attrNames outputs';
outputAttrs = attrNames (head (attrValues outputs'));
list = map (attr: {
name = attr;
value = listToAttrs (map (system: {
name = system;
value = getAttr attr (getAttr system outputs');
}) systems);
}) outputAttrs;
in listToAttrs list;
final = finalize (forAllCrossSystems mkOutput);
in final;
}