2
0
Fork 0
Browse Source

Use cross-compliation pairs in Flake

20.02
Emery Hemingway 3 years ago
parent
commit
53a18acd08
  1. 22
      flake.lock
  2. 45
      flake.nix
  3. 11
      lib/default.nix
  4. 6
      packages.nix
  5. 10
      tests/default.nix
  6. 2
      tests/driver-linux.nix
  7. 4
      tests/driver-nova.nix

22
flake.lock

@ -23,33 +23,33 @@
"inputs": {
"nixpkgs": {
"inputs": {},
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
"narHash": "sha256-/9hMb9pgV8awDYYchUueplyKF6bz23b7z5gqQ999nro=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=d63ee96d86672a9cb23d83d50ee02687eded2818"
}
},
"narHash": "sha256-9/RR/CwvB1M2VSR7CrSVexYXN1YSSSE4WG4siDh0LE0=",
"narHash": "sha256-7X6XqNVzCzMRqq0LV+NLdfS1h7gWi+psnRNl4mwdPCY=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode.git",
"url": "git+https://gitea.c3d2.de/ehmry/genode.git?ref=master&rev=2a9178fced42cac986de07b6944afd4422d28976"
"url": "git+https://gitea.c3d2.de/ehmry/genode.git?ref=master&rev=32f8b603cb09bd85b8ad9092b55b4f3869da19d5"
},
"genode-depot": {
"inputs": {
"nixpkgs": {
"inputs": {},
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
"originalUrl": "nixpkgs",
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
"narHash": "sha256-/9hMb9pgV8awDYYchUueplyKF6bz23b7z5gqQ999nro=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=d63ee96d86672a9cb23d83d50ee02687eded2818"
}
},
"narHash": "sha256-be9whulZ8unz1sq9PiFr+tuUAXlwiPEhIe0Z6jmfZiU=",
"narHash": "sha256-uTHTwa05KzSmRETVBhpHw2CD+cMicqunaaknYsrxAfY=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/genode-depot.git",
"url": "git+https://gitea.c3d2.de/ehmry/genode-depot.git?ref=master&rev=2f3162d88220bd6fa6b6fbc7c6d9fed68533a761"
"url": "git+https://gitea.c3d2.de/ehmry/genode-depot.git?ref=master&rev=ac11a14f9ba10685ae68ab5a050baf546ae702d2"
},
"nixpkgs": {
"inputs": {},
"narHash": "sha256-HYX9rCn1dweN+L3ecNy4BiCGw4WEt1zgdIiAeYNY5GM=",
"narHash": "sha256-/9hMb9pgV8awDYYchUueplyKF6bz23b7z5gqQ999nro=",
"originalUrl": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode",
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=12e31ac07c6d337760b3f59dc64c03f26cdd2009"
"url": "git+https://gitea.c3d2.de/ehmry/nixpkgs.git?ref=genode&rev=d63ee96d86672a9cb23d83d50ee02687eded2818"
}
},
"version": 3

45
flake.nix

@ -19,24 +19,33 @@
in {
lib = import ./lib {
genodepkgs = self;
inherit nixpkgs dhall-haskell genode-depot;
};
packages = forAllSystems (system:
let thisSystem = builtins.getAttr system;
in import ./packages.nix {
inherit system nixpkgs;
depot = thisSystem genode-depot.packages;
genode = thisSystem genode.packages;
} // builtins.getAttr system genode.packages);
checks = forAllSystems (system:
import ./tests {
inherit self nixpkgs dhall-haskell genode-depot;
genodepkgs = builtins.getAttr system self.packages;
});
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 {
inherit system nixpkgs;
depot = thisSystem genode-depot.packages;
genode = thisSystem genode.packages;
} // builtins.getAttr system genode.packages);
checks = nixpkgs.lib.forAllCrossSystems
({ system, localSystem, crossSystem }:
import ./tests {
inherit self system localSystem crossSystem nixpkgs dhall-haskell
genode-depot;
genodepkgs = builtins.getAttr system self.packages;
lib = builtins.getAttr system self.lib;
}) // {
x86_64-linux = self.checks.x86_64-linux-x86_64-genode;
};
};
}

11
lib/default.nix

@ -1,12 +1,13 @@
{ genodepkgs, nixpkgs, dhall-haskell, genode-depot }:
{ system, localSystem, crossSystem, genodepkgs, nixpkgs, dhall-haskell, genode-depot }:
let
hostPkgs = import nixpkgs {
system = "x86_64-linux";
system = localSystem;
overlays = [ (self: super: { inherit (dhall-haskell.packages) dhall; }) ];
};
testPkgs = genodepkgs.packages.x86_64-genode;
depot = genode-depot.packages.x86_64-genode;
thisSystem = builtins.getAttr system;
testPkgs = thisSystem genodepkgs.packages;
depot = thisSystem genode-depot.packages;
in {
dhallText = name: source:
@ -37,7 +38,7 @@ in {
xmllint --noout $out
'';
x86_64-genode.buildNovaIso = { name, rom }:
buildNovaIso = { name, rom }:
let
inherit (hostPkgs) cdrkit syslinux;

6
packages.nix

@ -15,11 +15,11 @@ let
dhallPackages = super.dhallPackages // (callPackage ./dhall { });
in rec {
inherit (super) stdenv;
libc = callPackage ./pkgs/libc { inherit depot; };
stdcxx = callPackage ./pkgs/stdcxx { };
nic_bus = callPackage ./pkgs/nic_bus { inherit (genode) base os; };
dhallGenode = dhallPackages.genode;
dhallPrelude = dhallPackages.prelude;
libc = callPackage ./pkgs/libc { inherit depot; };
nic_bus = callPackage ./pkgs/nic_bus { inherit (genode) base os; };
nova = callPackage ./NOVA { };
solo5 = callPackage ./pkgs/solo5 { inherit (genode) base os; };
stdcxx = callPackage ./pkgs/stdcxx { };
}

10
tests/default.nix

@ -11,25 +11,23 @@ let
# solo5 = call ./solo5 { };
};
in { self, genodepkgs, nixpkgs, dhall-haskell, genode-depot }:
in { self, system, localSystem, crossSystem, genodepkgs, nixpkgs, dhall-haskell, genode-depot, lib }:
let
hostPkgs = import nixpkgs {
system = "x86_64-linux";
system = localSystem;
overlays = [ (self: super: { inherit (dhall-haskell.packages) dhall; }) ];
};
depot = genode-depot.packages.x86_64-genode;
depot = builtins.getAttr crossSystem genode-depot.packages;
testPkgs = genodepkgs;
lib = hostPkgs.lib // self.lib;
linux = tests (import ./driver-linux.nix {
inherit testPkgs hostPkgs lib depot;
}).callTest;
nova = (call: ((tests call) // { pci = call ./pci.nix { }; }))
(import ./driver-nova.nix {
inherit testPkgs hostPkgs lib depot;
inherit system testPkgs hostPkgs lib depot;
}).callTest;
testsToList = tests:

2
tests/driver-linux.nix

@ -44,7 +44,7 @@ let
config = ./driver-config.xml;
core = "${base-linux}/bin/core-linux";
init = "${os}/bin/init";
"ld.lib.so" = "${depot.base-linux}/lib/ld.lib.so";
"ld.lib.so" = "${base-linux}/bin/ld-linux.lib.so";
timer = "${base-linux}/bin/linux_timer_drv";
} // bootModules;

4
tests/driver-nova.nix

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: LicenseRef-Hippocratic-1.1
{ testPkgs, hostPkgs, lib, depot }:
{ system, testPkgs, hostPkgs, lib, depot }:
let
testDriver = with hostPkgs;
@ -45,7 +45,7 @@ let
config = ./driver-config.xml;
} // bootModules);
iso = lib.x86_64-genode.buildNovaIso {
iso = lib.buildNovaIso {
inherit name;
rom = bootModules';
};

Loading…
Cancel
Save