Refactor flake to expose x86_64-linux-x86_64-genode as x86_64-linux
This commit is contained in:
parent
32f8b603cb
commit
bab7a572fe
26
default.nix
26
default.nix
|
@ -10,17 +10,30 @@ let
|
|||
nixpkgs =
|
||||
args.nixpkgs or (pinnedNixpkgs { inherit localSystem crossSystem; });
|
||||
|
||||
inherit (nixpkgs) stdenv buildPackages fetchgit llvmPackages;
|
||||
inherit (nixpkgs) stdenv buildPackages llvmPackages;
|
||||
|
||||
src = self.outPath or ./.;
|
||||
src = self.outPath or (builtins.fetchGit ./.);
|
||||
version = self.lastModified or "unstable";
|
||||
|
||||
inherit (stdenv) lib targetPlatform;
|
||||
specs = with targetPlatform;
|
||||
[ ] ++ lib.optional is32bit "32bit" ++ lib.optional is64bit "64bit"
|
||||
++ lib.optional isAarch32 "arm" ++ lib.optional isAarch64 "arm_64"
|
||||
++ lib.optional isRiscV "riscv" ++ lib.optional isx86 "x86"
|
||||
++ lib.optional isx86_32 "x86_32" ++ lib.optional isx86_64 "x86_64";
|
||||
[ ]
|
||||
|
||||
++ lib.optional is32bit "32bit"
|
||||
|
||||
++ lib.optional is64bit "64bit"
|
||||
|
||||
++ lib.optional isAarch32 "arm"
|
||||
|
||||
++ lib.optional isAarch64 "arm_64"
|
||||
|
||||
++ lib.optional isRiscV "riscv"
|
||||
|
||||
++ lib.optional isx86 "x86"
|
||||
|
||||
++ lib.optional isx86_32 "x86_32"
|
||||
|
||||
++ lib.optional isx86_64 "x86_64";
|
||||
|
||||
buildRepo = { repo, repoInputs }:
|
||||
let
|
||||
|
@ -85,7 +98,6 @@ let
|
|||
for R in repos/*; do
|
||||
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete
|
||||
done
|
||||
find repos/gems -name Tupfile -delete
|
||||
|
||||
# Scan repository and generate script
|
||||
tup init
|
||||
|
|
53
flake.nix
53
flake.nix
|
@ -5,16 +5,53 @@
|
|||
|
||||
inputs.nixpkgs.uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode";
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
packages = nixpkgs.lib.forAllCrossSystems
|
||||
({ system, localSystem, crossSystem }:
|
||||
import ./default.nix {
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
mkOutput = { system, localSystem, crossSystem }: rec {
|
||||
packages = import ./default.nix {
|
||||
inherit localSystem crossSystem self;
|
||||
nixpkgs = builtins.getAttr system nixpkgs.legacyPackages;
|
||||
});
|
||||
};
|
||||
defaultPackage = packages.base-linux;
|
||||
};
|
||||
|
||||
defaultPackage.x86_64-linux = self.packages.x86_64-linux-x86_64-genode.os;
|
||||
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;
|
||||
|
||||
hydraJobs = self.packages;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue