flake: support aarch64-linux

...I don't know how to remove the mention of x86_64-linux for colmena,
or if it actually matters, so I'm just leaving that there for now.
This commit is contained in:
Luke Granger-Brown 2024-07-21 15:03:29 +00:00 committed by Yureka
parent 74e06ac6d0
commit 7f29885597

View file

@ -25,30 +25,38 @@
outputs = { self, nixpkgs, terranix, colmena, ... } @ inputs: outputs = { self, nixpkgs, terranix, colmena, ... } @ inputs:
let let
system = "x86_64-linux"; supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
pkgs = import nixpkgs { forEachSystem = f: builtins.listToAttrs (map (system: {
localSystem = system; name = system;
overlays = [ value = f system;
inputs.hydra.overlays.default }) supportedSystems);
inputs.lix.overlays.default systemBits = forEachSystem (system: rec {
inputs.nix-gerrit.overlays.default
];
};
lib = pkgs.lib;
terraform = pkgs.opentofu;
terraformCfg = terranix.lib.terranixConfiguration {
inherit system; inherit system;
modules = [ pkgs = import nixpkgs {
./terraform localSystem = system;
{ overlays = [
bagel.gandi.enable = true; inputs.hydra.overlays.default
bagel.hydra.enable = true; inputs.lix.overlays.default
} inputs.nix-gerrit.overlays.default
]; ];
}; };
terraform = pkgs.opentofu;
terraformCfg = terranix.lib.terranixConfiguration {
inherit system;
modules = [
./terraform
{
bagel.gandi.enable = true;
bagel.hydra.enable = true;
}
];
};
});
forEachSystem' = f: forEachSystem (system: (f systemBits.${system}));
inherit (nixpkgs) lib;
in in
{ {
apps.${system} = { apps = forEachSystem' ({ system, pkgs, terraformCfg, terraform, ... }: {
tf = { tf = {
type = "app"; type = "app";
program = toString (pkgs.writers.writeBash "tf" '' program = toString (pkgs.writers.writeBash "tf" ''
@ -59,17 +67,19 @@
}; };
default = self.apps.${system}.tf; default = self.apps.${system}.tf;
}; });
devShells.${system}.default = pkgs.mkShell { devShells = forEachSystem' ({ system, pkgs, ... }: {
packages = [ default = pkgs.mkShell {
inputs.agenix.packages.${system}.agenix packages = [
inputs.agenix.packages.${system}.agenix
pkgs.opentofu pkgs.opentofu
(pkgs.callPackage ./lib/colmena-wrapper.nix { }) (pkgs.callPackage ./lib/colmena-wrapper.nix { })
]; ];
}; };
});
nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes; nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes;
@ -91,14 +101,7 @@
builders = lib.listToAttrs (lib.genList makeBuilder 12); builders = lib.listToAttrs (lib.genList makeBuilder 12);
in { in {
meta.nixpkgs = import nixpkgs { meta.nixpkgs = systemBits.x86_64-linux.pkgs;
localSystem = system;
overlays = [
inputs.hydra.overlays.default
inputs.lix.overlays.default
inputs.nix-gerrit.overlays.default
];
};
meta.specialArgs.inputs = inputs; meta.specialArgs.inputs = inputs;
bagel-box.imports = commonModules ++ [ ./hosts/bagel-box ]; bagel-box.imports = commonModules ++ [ ./hosts/bagel-box ];