2
0
Fork 0
genodepkgs/flake.nix

134 lines
4.1 KiB
Nix
Raw Normal View History

2020-01-17 01:24:34 +01:00
# SPDX-License-Identifier: CC0-1.0
2019-10-28 20:19:52 +01:00
{
edition = 201909;
2019-11-05 17:38:47 +01:00
description = "Genode packages";
2019-10-28 20:19:52 +01:00
inputs = {
2020-02-04 15:56:16 +01:00
genode-depot.uri = "git+https://git.sr.ht/~ehmry/genode-depot";
2020-01-14 12:16:02 +01:00
nixpkgs.uri = "github:ehmry/nixpkgs";
nixpkgsUpstream.uri = "github:NixOS/nixpkgs";
2019-10-28 20:19:52 +01:00
};
outputs = { self, genode-depot, nixpkgs, nixpkgsUpstream }:
2019-11-05 17:38:47 +01:00
let
localSystems = [ "x86_64-linux" ];
crossSystems = [ "x86_64-genode" ];
forAllLocalSystems = f:
nixpkgs.lib.genAttrs localSystems (system: f system);
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;
forAllSystems = f:
(forAllCrossSystems f) // (forAllLocalSystems (system:
f {
inherit system;
localSystem = system;
crossSystem = system;
}));
nixpkgsFor = forAllSystems ({ system, localSystem, crossSystem }:
if localSystem == crossSystem then
import nixpkgsUpstream {
inherit system;
overlays = [ self.overlay ];
}
else
import nixpkgs {
inherit localSystem crossSystem;
config.allowUnsupportedSystem = true;
overlays = [ self.overlay ];
});
in rec {
overlay = import ./overlay;
lib = forAllCrossSystems ({ system, localSystem, crossSystem }:
(nixpkgs.lib) // (import ./lib {
inherit system localSystem crossSystem;
apps = self.apps.${system};
nixpkgs = nixpkgsFor.${system};
genode-depot = genode-depot.packages.${system};
genodepkgs = self;
}));
legacyPackages = forAllSystems
({ system, localSystem, crossSystem }: nixpkgsFor.${system});
# pass thru Nixpkgs
packages = forAllCrossSystems ({ system, localSystem, crossSystem }:
import ./packages {
inherit system;
legacyPackages = self.legacyPackages.${system};
apps = self.apps.${system};
localPackages = nixpkgsUpstream.legacyPackages.${localSystem};
depot = genode-depot.packages.${system};
});
devShell = forAllLocalSystems (system:
let
pkgs = nixpkgsFor.${system};
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.x86_64-linux-x86_64-genode.genodeSources.toolchain.src}";
hash = "sha256-26rPvLUPEJm40zLSqTquwuFTJ1idTB0T4VXgaHRN+4o=";
};
in "ln -s ${toolchain}/local usr/local";
2019-12-02 16:39:52 +01:00
};
in pkgs.stdenv.mkDerivation {
name = "genode-fhs-shell";
nativeBuildInputs = [ fhs ];
shellHook = "exec genode-env";
});
apps = forAllCrossSystems ({ system, localSystem, crossSystem }:
import ./apps {
self = self.apps.${system};
nixpkgs = self.legacyPackages.${system};
nixpkgsLocal = nixpkgsFor.${localSystem};
packages = self.packages.${system};
});
checks = forAllCrossSystems ({ system, localSystem, crossSystem }:
import ./tests {
inherit system localSystem crossSystem;
inherit self nixpkgs genode-depot;
apps = self.apps.${system};
lib = self.lib.${system};
genodepkgs = self.packages.${system};
});
};
2019-10-28 20:19:52 +01:00
}