2021-05-02 19:35:29 +02:00
|
|
|
{ lib, deploy }:
|
2021-05-02 02:46:30 +02:00
|
|
|
{
|
|
|
|
mkHomeConfigurations = nixosConfigurations:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
mkHomes = host: config:
|
|
|
|
mapAttrs' (user: v: nameValuePair "${user}@${host}" v.home)
|
|
|
|
config.config.system.build.homes;
|
|
|
|
|
|
|
|
hmConfigs = mapAttrs mkHomes nixosConfigurations;
|
|
|
|
|
|
|
|
in
|
|
|
|
foldl recursiveUpdate { } (attrValues hmConfigs);
|
|
|
|
|
2021-05-02 19:35:29 +02:00
|
|
|
mkDeployNodes = hosts: extraConfig:
|
2021-05-02 02:46:30 +02:00
|
|
|
/**
|
|
|
|
Synopsis: mkNodes _nixosConfigurations_
|
|
|
|
|
|
|
|
Generate the `nodes` attribute expected by deploy-rs
|
|
|
|
where _nixosConfigurations_ are `nodes`.
|
|
|
|
**/
|
|
|
|
|
2021-05-02 19:35:29 +02:00
|
|
|
lib.mapAttrs
|
|
|
|
(_: config: lib.recursiveUpdate
|
|
|
|
{
|
|
|
|
hostname = config.config.networking.hostName;
|
|
|
|
|
|
|
|
profiles.system = {
|
|
|
|
user = "root";
|
|
|
|
path = deploy.lib.x86_64-linux.activate.nixos config;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
extraConfig)
|
|
|
|
hosts;
|
2021-05-02 02:46:30 +02:00
|
|
|
|
|
|
|
mkSuites = { suites, profiles }:
|
|
|
|
let
|
|
|
|
profileSet = lib.genAttrs' profiles (path: {
|
|
|
|
name = baseNameOf path;
|
|
|
|
value = lib.mkProfileAttrs (toString path);
|
|
|
|
});
|
|
|
|
|
|
|
|
definedSuites = suites profileSet;
|
|
|
|
|
|
|
|
allProfiles = lib.collectProfiles profileSet;
|
|
|
|
in
|
|
|
|
lib.mapAttrs (_: v: lib.profileMap v) definedSuites // {
|
|
|
|
inherit allProfiles;
|
|
|
|
};
|
|
|
|
}
|