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 =
|
nixpkgs =
|
||||||
args.nixpkgs or (pinnedNixpkgs { inherit localSystem crossSystem; });
|
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";
|
version = self.lastModified or "unstable";
|
||||||
|
|
||||||
inherit (stdenv) lib targetPlatform;
|
inherit (stdenv) lib targetPlatform;
|
||||||
specs = with 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 is32bit "32bit"
|
||||||
++ lib.optional isx86_32 "x86_32" ++ lib.optional isx86_64 "x86_64";
|
|
||||||
|
++ 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 }:
|
buildRepo = { repo, repoInputs }:
|
||||||
let
|
let
|
||||||
|
@ -85,7 +98,6 @@ let
|
||||||
for R in repos/*; do
|
for R in repos/*; do
|
||||||
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete
|
[ "$R" != "repos/$repo" ] && find $R -name Tupfile -delete
|
||||||
done
|
done
|
||||||
find repos/gems -name Tupfile -delete
|
|
||||||
|
|
||||||
# Scan repository and generate script
|
# Scan repository and generate script
|
||||||
tup init
|
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";
|
inputs.nixpkgs.uri = "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode";
|
||||||
|
|
||||||
outputs = { self, nixpkgs }: {
|
outputs = { self, nixpkgs }:
|
||||||
packages = nixpkgs.lib.forAllCrossSystems
|
let
|
||||||
({ system, localSystem, crossSystem }:
|
mkOutput = { system, localSystem, crossSystem }: rec {
|
||||||
import ./default.nix {
|
packages = import ./default.nix {
|
||||||
inherit localSystem crossSystem self;
|
inherit localSystem crossSystem self;
|
||||||
nixpkgs = builtins.getAttr system nixpkgs.legacyPackages;
|
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