buildClan: replace all usages by lib.clan

This commit is contained in:
Johannes Kirschbauer
2025-07-01 11:56:31 +02:00
parent 78379e81e4
commit 667cee0f6e
11 changed files with 41 additions and 43 deletions

View File

@@ -6,7 +6,7 @@
{ self, clan-core, ... }:
let
# Usage see: https://docs.clan.lol
clan = clan-core.clanLib.buildClan {
clan = clan-core.lib.clan {
inherit self;
inventory =
@@ -66,6 +66,6 @@
in
{
# all machines managed by Clan
inherit (clan) nixosConfigurations nixosModules clanInternals;
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
};
}

View File

@@ -4,7 +4,7 @@
...
}:
let
testFlake = clanLib.buildClan {
testFlake = clanLib.clan {
# Point to the folder of the module
# TODO: make this optional
directory = ./..;
@@ -43,7 +43,7 @@ let
in
{
test_simple = {
inherit testFlake;
config = testFlake.config;
expr = { };
expected = { };

View File

@@ -4,7 +4,7 @@
...
}:
let
testFlake = clanLib.buildClan {
testFlake = clanLib.clan {
# Point to the folder of the module
# TODO: make this optional
directory = ./..;
@@ -47,7 +47,7 @@ in
inherit testFlake;
expr =
testFlake.clan.clanInternals.inventoryClass.distributedServices.importedModulesEvaluated.self-wifi.config;
testFlake.config.clan.clanInternals.inventoryClass.distributedServices.importedModulesEvaluated.self-wifi.config;
expected = 1;
# expr = {

View File

@@ -4,32 +4,33 @@
...
}:
let
testFlake = clanLib.buildClan {
directory = ./vm;
testFlake =
(clanLib.clan {
directory = ./vm;
machines.jon = {
nixpkgs.hostPlatform = "x86_64-linux";
};
machines.sara = {
nixpkgs.hostPlatform = "x86_64-linux";
};
machines.bam = {
nixpkgs.hostPlatform = "x86_64-linux";
};
modules.zerotier = module;
inventory.instances = {
zerotier = {
module.name = "zerotier";
module.input = "self";
roles.peer.tags.all = { };
roles.moon.machines.sara.settings.stableEndpoints = [ "10.0.0.3/9993" ];
roles.controller.machines.bam = { };
machines.jon = {
nixpkgs.hostPlatform = "x86_64-linux";
};
};
};
machines.sara = {
nixpkgs.hostPlatform = "x86_64-linux";
};
machines.bam = {
nixpkgs.hostPlatform = "x86_64-linux";
};
modules.zerotier = module;
inventory.instances = {
zerotier = {
module.name = "zerotier";
module.input = "self";
roles.peer.tags.all = { };
roles.moon.machines.sara.settings.stableEndpoints = [ "10.0.0.3/9993" ];
roles.controller.machines.bam = { };
};
};
}).config;
in
{
test_peers = {

View File

@@ -31,9 +31,7 @@ in
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.evalTests-build-clan
legacyPackages.evalTests-build-clan = import ./tests.nix {
inherit lib;
inherit (inputs) nixpkgs;
clan-core = self;
buildClan = self.clanLib.buildClan;
};
checks = {
eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''

View File

@@ -1,7 +1,6 @@
{
lib,
clan-core,
...
}:
let
# Shallowly force all attribute values to be evaluated.

View File

@@ -19,7 +19,7 @@
builtins.fromJSON (builtins.readFile ./clan_attrs.json)
else
{ };
clan = clan-core.clanLib.buildClan {
clan = clan-core.lib.clan {
inherit self;
meta.name = "test_flake_with_core";
# Don't quote this will be replaced by the inventory expression
@@ -62,6 +62,6 @@
in
{
clan = clan_attrs_json;
inherit (clan) nixosConfigurations nixosModules clanInternals;
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
};
}

View File

@@ -8,7 +8,7 @@
outputs =
{ self, clan-core }:
let
clan = clan-core.clanLib.buildClan {
clan = clan-core.lib.clan {
inherit self;
meta.name = "test_flake_with_core_and_pass";
machines = {
@@ -44,6 +44,6 @@
};
in
{
inherit (clan) nixosConfigurations nixosModules clanInternals;
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
};
}

View File

@@ -8,7 +8,7 @@
outputs =
{ self, clan-core }:
let
clan = clan-core.clanLib.buildClan {
clan = clan-core.lib.clan {
inherit self;
meta.name = "test_flake_with_core_dynamic_machines";
machines =
@@ -19,6 +19,6 @@
};
in
{
inherit (clan) nixosConfigurations nixosModules clanInternals;
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
};
}

View File

@@ -6,10 +6,10 @@
{ self, clan-core, ... }:
let
# Usage see: https://docs.clan.lol
clan = clan-core.clanLib.buildClan { inherit self; };
clan = clan-core.lib.clan { inherit self; };
in
{
# all machines managed by Clan
inherit (clan) nixosConfigurations nixosModules clanInternals;
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
};
}

View File

@@ -6,7 +6,7 @@
{ self, clan-core, ... }:
let
# Usage see: https://docs.clan.lol
clan = clan-core.clanLib.buildClan {
clan = clan-core.lib.clan {
inherit self;
# Ensure this is unique among all clans you want to use.
meta.name = "__CHANGE_ME__";
@@ -26,7 +26,7 @@
};
in
{
inherit (clan) nixosConfigurations nixosModules clanInternals;
inherit (clan.config) nixosConfigurations nixosModules clanInternals;
# Add the Clan cli tool to the dev shell.
# Use "nix develop" to enter the dev shell.
devShells =