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
*/
{ lib, inputs }: let
getFqdn = c: let
{ lib, inputs }:
let
getFqdn =
c:
let
net = c.config.networking;
fqdn =
if (net ? domain) && (net.domain != null)
then "${net.hostName}.${net.domain}"
else net.hostName;
if (net ? domain) && (net.domain != null) then "${net.hostName}.${net.domain}" else net.hostName;
in
fqdn;
in {
mkDeployNodes = systemConfigurations: extraConfig:
mkDeployNodes =
systemConfigurations: extraConfig:
/*
*
Synopsis: mkNodes _systemConfigurations_ _extraConfig_
@ -46,17 +48,32 @@ in {
```
*
*/
lib.recursiveUpdate
(lib.mapAttrs
(
_: c: {
lib.recursiveUpdate (lib.mapAttrs ( _: c: {
hostname = getFqdn c;
profiles.system = {
user = "root";
path = inputs.deploy-rs.lib.${c.pkgs.stdenv.hostPlatform.system}.activate.nixos c;
profiles.system =
let
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;
}