32 lines
1.1 KiB
Nix
32 lines
1.1 KiB
Nix
{ depot, lib, pkgs, ... }@args:
|
|
let
|
|
inherit (builtins) foldl' mapAttrs;
|
|
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;
|
|
systems = [ "porcorosso" "ixvm-fra01" "marukuru" "clouvider-fra01" ];
|
|
rebuilder = system:
|
|
pkgs.writeShellScriptBin "rebuilder" ''
|
|
set -ue
|
|
if [[ $EUID -ne 0 ]]; then
|
|
exec sudo "$0" "$@"
|
|
fi
|
|
|
|
export AWS_ACCESS_KEY_ID="${depot.ops.secrets.nixCache.AWS_ACCESS_KEY_ID}"
|
|
export AWS_SECRET_ACCESS_KEY="${depot.ops.secrets.nixCache.AWS_SECRET_ACCESS_KEY}"
|
|
|
|
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
|
|
(name: import (./. + "/${name}"));
|
|
systemDrvs = mapAttrs systemFor systemCfgs;
|
|
in systemDrvs
|