2020-04-30 04:49:19 +00:00
|
|
|
{ depot, lib, pkgs, ... }@args:
|
|
|
|
let
|
|
|
|
inherit (builtins) foldl' mapAttrs;
|
2020-05-08 22:26:21 +00:00
|
|
|
baseModule = name: { ... }: {
|
|
|
|
_module.args = args // {
|
|
|
|
rebuilder = rebuilder name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemFor = systemName: config:
|
|
|
|
(depot.third_party.nixeval {
|
|
|
|
system = builtins.currentSystem;
|
|
|
|
modules = [ (baseModule systemName) (args: { imports = [ lib/common.nix config ]; }) ];
|
|
|
|
}).config.system.build.toplevel;
|
2020-05-05 23:28:23 +00:00
|
|
|
systems = [ "porcorosso" "ixvm-fra01" "marukuru" "clouvider-fra01" ];
|
2020-04-30 04:49:19 +00:00
|
|
|
rebuilder = system:
|
|
|
|
pkgs.writeShellScriptBin "rebuilder" ''
|
|
|
|
set -ue
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
exec sudo "$0" "$@"
|
|
|
|
fi
|
|
|
|
|
|
|
|
system="$(nix-build -E '(import <depot> {}).ops.nixos.${system}' --no-out-link)"
|
|
|
|
nix-env -p /nix/var/nix/profiles/system --set "$system"
|
|
|
|
"$system/bin/switch-to-configuration" switch
|
|
|
|
'';
|
|
|
|
systemCfgs = lib.genAttrs systems
|
2020-05-08 22:26:21 +00:00
|
|
|
(name: import (./. + "/${name}"));
|
|
|
|
systemDrvs = mapAttrs systemFor systemCfgs;
|
2020-04-30 04:49:19 +00:00
|
|
|
in systemDrvs
|