2
0
genodepkgs/flake.nix

101 lines
2.8 KiB
Nix
Raw Normal View History

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 = {
2019-11-05 16:00:56 +01:00
dhall-haskell.uri =
"git+https://github.com/dhall-lang/dhall-haskell?ref=flake";
2019-11-19 16:36:52 +01:00
genode-depot.uri = "git+https://gitea.c3d2.de/ehmry/genode-depot.git";
2020-01-14 12:16:02 +01:00
nixpkgs.uri = "github:ehmry/nixpkgs";
2019-10-28 20:19:52 +01:00
};
outputs = { self, dhall-haskell, genode-depot, nixpkgs }:
2019-11-05 17:38:47 +01:00
let
mkOutput = { system, localSystem, crossSystem }:
let thisSystem = builtins.getAttr system;
in rec {
2019-10-28 20:19:52 +01:00
2020-01-16 17:19:42 +01:00
packages = import ./packages {
inherit system nixpkgs;
depot = thisSystem genode-depot.packages;
dhallApps = dhall-haskell.apps.${localSystem};
};
legacyPackages = thisSystem nixpkgs.legacyPackages;
# pass thru Nixpkgs
2019-10-28 20:19:52 +01:00
defaultPackage = packages.genode.base-linux;
2019-10-28 20:19:52 +01:00
devShell = packages.stdenv;
apps = import ./apps {
nixpkgs = legacyPackages;
dhallApps = dhall-haskell.apps.${localSystem};
inherit packages;
};
lib = (nixpkgs.lib) // (import ./lib {
inherit system localSystem crossSystem;
inherit nixpkgs dhall-haskell genode-depot;
2019-12-02 16:39:52 +01:00
genodepkgs = self;
});
2019-12-02 16:39:52 +01:00
nixosModule = ./nixos;
checks = (import ./tests {
inherit system localSystem crossSystem;
inherit self nixpkgs dhall-haskell genode-depot;
lib = thisSystem self.lib;
genodepkgs = thisSystem self.packages;
2019-12-02 16:39:52 +01:00
}) // {
nixos = import ./nixos/test.nix {
system = localSystem;
depot = genode-depot;
genodepkgs = self;
inherit nixpkgs;
};
};
};
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;
2019-12-02 16:39:52 +01:00
};
systems = attrNames outputs';
outputAttrs = attrNames (head (attrValues outputs'));
2019-12-14 11:58:56 +01:00
list = map (attr: {
name = attr;
value = listToAttrs (map (system: {
name = system;
value = getAttr attr (getAttr system outputs');
}) systems);
}) outputAttrs;
2019-12-14 11:58:56 +01:00
in listToAttrs list;
2019-12-14 11:58:56 +01:00
final = finalize (forAllCrossSystems mkOutput);
in final;
2019-10-28 20:19:52 +01:00
}