2
0
Fork 0

Expose x86_64-linux-x86_64-genode as x86_64-linux

These packages will execute with the Linux kernel, so pass them thru as
a convience.
This commit is contained in:
Emery Hemingway 2019-12-20 07:38:34 +00:00
parent 43989b1e0f
commit 7634f2fc08
1 changed files with 66 additions and 39 deletions

105
flake.nix
View File

@ -13,56 +13,83 @@
outputs = { self, dhall-haskell, genode-depot, genode, nixpkgs }:
let
systems = [ "x86_64-genode" ];
mkOutput = { system, localSystem, crossSystem }:
let thisSystem = builtins.getAttr system;
in rec {
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in {
lib = nixpkgs.lib.forAllCrossSystems
({ system, localSystem, crossSystem }:
nixpkgs.lib // (import ./lib {
inherit system localSystem crossSystem nixpkgs dhall-haskell
genode-depot;
genodepkgs = self;
}));
packages = nixpkgs.lib.forAllCrossSystems
({ system, localSystem, crossSystem }:
let thisSystem = builtins.getAttr system;
in import ./packages.nix {
packages = import ./packages.nix {
inherit system nixpkgs;
depot = thisSystem genode-depot.packages;
genode = thisSystem genode.packages;
} // thisSystem genode.packages) //
{ x86_64-linux = self.packages.x86_64-linux-x86_64-genode; };
} // thisSystem genode.packages;
defaultPackage.x86_64-linux =
self.packages.x86_64-linux-x86_64-genode.base-linux;
legacyPackages = thisSystem nixpkgs.legacyPackages;
# pass thru Nixpkgs
checks = nixpkgs.lib.forAllCrossSystems
({ system, localSystem, crossSystem }:
let thisSystem = builtins.getAttr system;
in import ./tests {
inherit self system localSystem crossSystem nixpkgs dhall-haskell
genode-depot;
genodepkgs = thisSystem self.packages;
defaultPackage = packages.base-linux;
devShell = packages.stdenv;
lib = (nixpkgs.lib) // (import ./lib {
inherit system localSystem crossSystem;
inherit nixpkgs dhall-haskell genode-depot;
genodepkgs = self;
});
nixosModule = ./nixos;
checks = (import ./tests {
inherit system localSystem crossSystem;
inherit self nixpkgs dhall-haskell genode-depot;
lib = thisSystem self.lib;
genodepkgs = thisSystem self.packages;
}) // {
x86_64-linux.nixos =
let pkgs' = nixpkgs.legacyPackages.x86_64-linux // { };
in import ./nixos/test.nix {
system = "x86_64-linux";
depot = genode-depot;
genodepkgs = self;
inherit nixpkgs;
};
nixos = import ./nixos/test.nix {
system = localSystem;
depot = genode-depot;
genodepkgs = self;
inherit nixpkgs;
};
};
nixosModule = import ./nixos;
};
devShell.x86_64-linux = self.packages.x86_64-linux-x86_64-genode.stdenv;
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;
}