Merge pull request #1262 from lheckemann/aarch64

Enable aarch64 support
This commit is contained in:
Eelco Dolstra 2022-11-21 11:01:38 +01:00 committed by GitHub
commit d4d20f6484
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,13 +6,15 @@
outputs = { self, nixpkgs, nix }: outputs = { self, nixpkgs, nix }:
let let
version = "${builtins.readFile ./version.txt}.${builtins.substring 0 8 (self.lastModifiedDate or "19700101")}.${self.shortRev or "DIRTY"}"; version = "${builtins.readFile ./version.txt}.${builtins.substring 0 8 (self.lastModifiedDate or "19700101")}.${self.shortRev or "DIRTY"}";
pkgs = import nixpkgs { systems = [ "x86_64-linux" "aarch64-linux" ];
system = "x86_64-linux"; forEachSystem = nixpkgs.lib.genAttrs systems;
pkgsBySystem = forEachSystem (system: import nixpkgs {
inherit system;
overlays = [ self.overlays.default nix.overlays.default ]; overlays = [ self.overlays.default nix.overlays.default ];
}; });
# NixOS configuration used for VM tests. # NixOS configuration used for VM tests.
hydraServer = hydraServer =
@ -254,9 +256,10 @@
hydraJobs = { hydraJobs = {
build.x86_64-linux = packages.x86_64-linux.hydra; build = forEachSystem (system: packages.${system}.hydra);
manual = manual = forEachSystem (system:
let pkgs = pkgsBySystem.${system}; in
pkgs.runCommand "hydra-manual-${version}" { } pkgs.runCommand "hydra-manual-${version}" { }
'' ''
mkdir -p $out/share mkdir -p $out/share
@ -264,10 +267,10 @@
mkdir $out/nix-support mkdir $out/nix-support
echo "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products echo "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products
''; '');
tests.install.x86_64-linux = tests.install = forEachSystem (system:
with import (nixpkgs + "/nixos/lib/testing-python.nix") { system = "x86_64-linux"; }; with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; };
simpleTest { simpleTest {
nodes.machine = hydraServer; nodes.machine = hydraServer;
testScript = testScript =
@ -279,10 +282,11 @@
machine.wait_for_open_port("3000") machine.wait_for_open_port("3000")
machine.succeed("curl --fail http://localhost:3000/") machine.succeed("curl --fail http://localhost:3000/")
''; '';
}; });
tests.notifications.x86_64-linux = tests.notifications = forEachSystem (system:
with import (nixpkgs + "/nixos/lib/testing-python.nix") { system = "x86_64-linux"; }; let pkgs = pkgsBySystem.${system}; in
with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; };
simpleTest { simpleTest {
nodes.machine = { pkgs, ... }: { nodes.machine = { pkgs, ... }: {
imports = [ hydraServer ]; imports = [ hydraServer ];
@ -336,10 +340,11 @@
+ "--data-urlencode 'q=SELECT * FROM hydra_build_status' | grep success" + "--data-urlencode 'q=SELECT * FROM hydra_build_status' | grep success"
) )
''; '';
}; });
tests.gitea.x86_64-linux = tests.gitea = forEachSystem (system:
with import (nixpkgs + "/nixos/lib/testing-python.nix") { system = "x86_64-linux"; }; let pkgs = pkgsBySystem.${system}; in
with import (nixpkgs + "/nixos/lib/testing-python.nix") { inherit system; };
makeTest { makeTest {
nodes.machine = { pkgs, ... }: { nodes.machine = { pkgs, ... }: {
imports = [ hydraServer ]; imports = [ hydraServer ];
@ -352,7 +357,7 @@
distributedBuilds = true; distributedBuilds = true;
buildMachines = [{ buildMachines = [{
hostName = "localhost"; hostName = "localhost";
systems = [ "x86_64-linux" ]; systems = [ system ];
}]; }];
binaryCaches = [ ]; binaryCaches = [ ];
}; };
@ -467,7 +472,7 @@
smallDrv = pkgs.writeText "jobset.nix" '' smallDrv = pkgs.writeText "jobset.nix" ''
{ trivial = builtins.derivation { { trivial = builtins.derivation {
name = "trivial"; name = "trivial";
system = "x86_64-linux"; system = "${system}";
builder = "/bin/sh"; builder = "/bin/sh";
allowSubstitutes = false; allowSubstitutes = false;
preferLocalBuild = true; preferLocalBuild = true;
@ -531,31 +536,37 @@
machine.shutdown() machine.shutdown()
''; '';
}; });
tests.validate-openapi = pkgs.runCommand "validate-openapi" tests.validate-openapi = forEachSystem (system:
let pkgs = pkgsBySystem.${system}; in
pkgs.runCommand "validate-openapi"
{ buildInputs = [ pkgs.openapi-generator-cli ]; } { buildInputs = [ pkgs.openapi-generator-cli ]; }
'' ''
openapi-generator-cli validate -i ${./hydra-api.yaml} openapi-generator-cli validate -i ${./hydra-api.yaml}
touch $out touch $out
''; '');
container = nixosConfigurations.container.config.system.build.toplevel; container = nixosConfigurations.container.config.system.build.toplevel;
}; };
checks.x86_64-linux.build = hydraJobs.build.x86_64-linux; checks = forEachSystem (system: {
checks.x86_64-linux.install = hydraJobs.tests.install.x86_64-linux; build = hydraJobs.build.${system};
checks.x86_64-linux.validate-openapi = hydraJobs.tests.validate-openapi; install = hydraJobs.tests.install.${system};
validate-openapi = hydraJobs.tests.validate-openapi.${system};
});
packages.x86_64-linux.hydra = pkgs.hydra; packages = forEachSystem (system: {
packages.x86_64-linux.default = pkgs.hydra; hydra = pkgsBySystem.${system}.hydra;
default = pkgsBySystem.${system}.hydra;
});
nixosModules.hydra = { nixosModules.hydra = {
imports = [ ./hydra-module.nix ]; imports = [ ./hydra-module.nix ];
nixpkgs.overlays = [ self.overlays.default nix.overlays.default ]; nixpkgs.overlays = [ self.overlays.default nix.overlays.default ];
}; };
nixosModules.hydraTest = { nixosModules.hydraTest = { pkgs, ... }: {
imports = [ self.nixosModules.hydra ]; imports = [ self.nixosModules.hydra ];
services.hydra-dev.enable = true; services.hydra-dev.enable = true;