Compare commits

...

1 commit

Author SHA1 Message Date
Luke Granger-Brown 96a1561862 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.
2024-07-21 15:03:29 +00:00

View file

@ -25,7 +25,13 @@
outputs = { self, nixpkgs, terranix, colmena, ... } @ inputs: outputs = { self, nixpkgs, terranix, colmena, ... } @ inputs:
let let
system = "x86_64-linux"; supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = f: builtins.listToAttrs (map (system: {
name = system;
value = f system;
}) supportedSystems);
systemBits = forEachSystem (system: rec {
inherit system;
pkgs = import nixpkgs { pkgs = import nixpkgs {
localSystem = system; localSystem = system;
overlays = [ overlays = [
@ -34,7 +40,6 @@
inputs.nix-gerrit.overlays.default inputs.nix-gerrit.overlays.default
]; ];
}; };
lib = pkgs.lib;
terraform = pkgs.opentofu; terraform = pkgs.opentofu;
terraformCfg = terranix.lib.terranixConfiguration { terraformCfg = terranix.lib.terranixConfiguration {
inherit system; inherit system;
@ -46,9 +51,12 @@
} }
]; ];
}; };
});
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,9 +67,10 @@
}; };
default = self.apps.${system}.tf; default = self.apps.${system}.tf;
}; });
devShells.${system}.default = pkgs.mkShell { devShells = forEachSystem' ({ system, pkgs, ... }: {
default = pkgs.mkShell {
packages = [ packages = [
inputs.agenix.packages.${system}.agenix inputs.agenix.packages.${system}.agenix
@ -69,6 +78,7 @@
pkgs.opentofu pkgs.opentofu
]; ];
}; };
});
nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes; nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes;
@ -90,14 +100,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 ];