nixfiles/systems.nix

36 lines
1.2 KiB
Nix
Raw Normal View History

2022-02-06 00:06:26 +00:00
{ lib, pkgsFlakes, inputs, modules }:
let
inherit (builtins) attrValues mapAttrs;
inherit (lib) mkDefault;
mkSystem = name: {
system,
nixpkgs ? "unstable",
config,
}:
let
2022-02-11 16:36:02 +00:00
pkgsFlake = pkgsFlakes.${nixpkgs};
lib = pkgsFlake.lib;
# TODO: This is mostly yoinked from nixpkgs/flake.nix master (as of 2022/02/11) since 21.11's version has hacky
# vm build stuff that breaks our impl. REMOVE WHEN 22.05 IS OUT!
nixosSystem' = args:
import "${pkgsFlake}/nixos/lib/eval-config.nix" (args // {
modules = args.modules ++ [ {
system.nixos.versionSuffix =
".${lib.substring 0 8 pkgsFlake.lastModifiedDate}.${pkgsFlake.shortRev}";
system.nixos.revision = pkgsFlake.rev;
} ];
});
in nixosSystem' {
2022-02-06 00:06:26 +00:00
inherit lib system;
2022-02-06 00:19:29 +00:00
specialArgs = { inherit inputs system; };
modules = attrValues modules ++ [ { networking.hostName = mkDefault name; } config ];
2022-02-06 00:06:26 +00:00
};
in mapAttrs mkSystem {
colony = {
system = "x86_64-linux";
2022-02-11 16:36:02 +00:00
nixpkgs = "stable";
2022-02-06 00:06:26 +00:00
config = boxes/colony.nix;
};
}