2020-04-30 04:49:19 +00:00
|
|
|
{ depot, lib, pkgs, ... }@args:
|
|
|
|
let
|
|
|
|
inherit (builtins) foldl' mapAttrs;
|
|
|
|
systemFor = configs:
|
|
|
|
(depot.third_party.nixos {
|
|
|
|
configuration = lib.fix
|
|
|
|
(config: foldl' lib.recursiveUpdate { } (map (c: c config) configs));
|
|
|
|
}).system;
|
2020-05-03 16:56:16 +00:00
|
|
|
systems = [ "porcorosso" "ixvm-fra01" "marukuru" ];
|
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
|
|
|
|
(name: import (./. + "/${name}") (args // { rebuilder = rebuilder name; }));
|
|
|
|
mapAttrValues = (f: set: mapAttrs (name: f) set);
|
|
|
|
systemDrvs = mapAttrValues (systemCfg: systemFor [ systemCfg ]) systemCfgs;
|
|
|
|
in systemDrvs
|