lib: use improved deploy-rs lib with overlay'ed pkg

This commit is contained in:
teutat3s 2024-06-13 01:17:18 +02:00
parent 09b8cc835f
commit dfe092a702
Signed by: teutat3s
GPG key ID: 4FA1D3FA524F22C1

View file

@ -5,17 +5,19 @@
* Licensed under the MIT license * Licensed under the MIT license
*/ */
{ lib, inputs }: let { lib, inputs }:
getFqdn = c: let let
getFqdn =
c:
let
net = c.config.networking; net = c.config.networking;
fqdn = fqdn =
if (net ? domain) && (net.domain != null) if (net ? domain) && (net.domain != null) then "${net.hostName}.${net.domain}" else net.hostName;
then "${net.hostName}.${net.domain}"
else net.hostName;
in in
fqdn; fqdn;
in { in {
mkDeployNodes = systemConfigurations: extraConfig: mkDeployNodes =
systemConfigurations: extraConfig:
/* /*
* *
Synopsis: mkNodes _systemConfigurations_ _extraConfig_ Synopsis: mkNodes _systemConfigurations_ _extraConfig_
@ -46,17 +48,32 @@ in {
``` ```
* *
*/ */
lib.recursiveUpdate lib.recursiveUpdate (lib.mapAttrs ( _: c: {
(lib.mapAttrs
(
_: c: {
hostname = getFqdn c; hostname = getFqdn c;
profiles.system = { profiles.system =
user = "root"; let
path = inputs.deploy-rs.lib.${c.pkgs.stdenv.hostPlatform.system}.activate.nixos c; system = c.pkgs.system;
# Unmodified nixpkgs
pkgs = import inputs.nixpkgs { inherit system; };
# nixpkgs with deploy-rs overlay but force the nixpkgs package
deployPkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.deploy-rs.overlays.default
(self: super: {
deploy-rs = {
inherit (pkgs) deploy-rs;
lib = super.deploy-rs.lib;
}; };
} })
) ];
systemConfigurations) };
extraConfig; in
{
user = "root";
path = deployPkgs.deploy-rs.lib.activate.nixos c;
};
}) systemConfigurations) extraConfig;
} }