# SPDX-License-Identifier: CC0-1.0 { edition = 201909; description = "Genode packages"; inputs = { dhall-haskell.uri = "git+https://github.com/dhall-lang/dhall-haskell?ref=flake"; genode-depot.uri = "git+https://gitea.c3d2.de/ehmry/genode-depot.git"; nixpkgs.uri = "github:ehmry/nixpkgs"; }; outputs = { self, dhall-haskell, genode-depot, nixpkgs }: let mkOutput = { system, localSystem, crossSystem }: let thisSystem = builtins.getAttr system; in rec { packages = import ./packages { inherit system nixpkgs; depot = thisSystem genode-depot.packages; dhallApps = dhall-haskell.apps.${localSystem}; }; legacyPackages = thisSystem nixpkgs.legacyPackages; # pass thru Nixpkgs defaultPackage = packages.genode.base-linux; 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; 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; }) // { 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; }; 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; }