Use cross-compile pairs in Flake

This commit is contained in:
Ehmry - 2019-12-02 15:53:26 +01:00
parent 94266a7bb0
commit 32f8b603cb
3 changed files with 28 additions and 23 deletions

View File

@ -1,15 +1,15 @@
{ localSystem ? "x86_64-linux", crossSystem ? "x86_64-genode", self ? { }, ...
}@args:
let let
nixpkgsGit = builtins.fetchGit { pinnedNixpkgs = import (builtins.fetchGit {
url = "https://gitea.c3d2.de/ehmry/nixpkgs.git"; url = "https://gitea.c3d2.de/ehmry/nixpkgs.git";
ref = "genode"; ref = "genode";
}; });
pinnedNixpkgs = import nixpkgsGit {
localSystem = "x86_64-linux"; nixpkgs =
crossSystem = "x86_64-genode"; args.nixpkgs or (pinnedNixpkgs { inherit localSystem crossSystem; });
};
in { system ? "x86_64-genode", self ? { }, nixpkgs ? pinnedNixpkgs }:
let
inherit (nixpkgs) stdenv buildPackages fetchgit llvmPackages; inherit (nixpkgs) stdenv buildPackages fetchgit llvmPackages;
src = self.outPath or ./.; src = self.outPath or ./.;
@ -25,15 +25,23 @@ let
buildRepo = { repo, repoInputs }: buildRepo = { repo, repoInputs }:
let let
tupArch = with stdenv.targetPlatform; tupArch = with stdenv.targetPlatform;
if isAarch32 then if isAarch32 then
"arm" "arm"
else if isAarch64 then else
if isAarch64 then
"arm64" "arm64"
else if isx86_32 then else
if isx86_32 then
"i386" "i386"
else if isx86_64 then else
if isx86_64 then
"x86_64" "x86_64"
else else
abort "unhandled targetPlatform"; abort "unhandled targetPlatform";
toTupConfig = attrs: toTupConfig = attrs:

View File

@ -2,9 +2,9 @@
"inputs": { "inputs": {
"nixpkgs": { "nixpkgs": {
"inputs": {}, "inputs": {},
"narHash": "sha256-g++A7ut8qyY3yi6WskTHwYbci6+MeTxJDLyzSrTjruM=", "narHash": "sha256-/9hMb9pgV8awDYYchUueplyKF6bz23b7z5gqQ999nro=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode", "originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=9426fc2248cfc706f7a659b04fcd6935515232bc" "url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=d63ee96d86672a9cb23d83d50ee02687eded2818"
} }
}, },
"version": 3 "version": 3

View File

@ -5,19 +5,16 @@
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 }: {
let packages = nixpkgs.lib.forAllCrossSystems
systems = [ "x86_64-genode" ]; ({ system, localSystem, crossSystem }:
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in {
packages = forAllSystems (system:
import ./default.nix { import ./default.nix {
inherit system self; inherit localSystem crossSystem self;
nixpkgs = builtins.getAttr system nixpkgs.legacyPackages; nixpkgs = builtins.getAttr system nixpkgs.legacyPackages;
}); });
defaultPackage = forAllSystems (system: self.packages."${system}".os); defaultPackage.x86_64-linux = self.packages.x86_64-linux-x86_64-genode.os;
hydraJobs = self.packages; hydraJobs = self.packages;
}; };
} }