Merge pull request 'buildClan: replace all usages by lib.clan' (#4167) from build-clan into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4167
This commit is contained in:
hsjobeki
2025-07-01 10:19:07 +00:00
11 changed files with 41 additions and 43 deletions

View File

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

View File

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

View File

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

View File

@@ -4,7 +4,8 @@
... ...
}: }:
let let
testFlake = clanLib.buildClan { testFlake =
(clanLib.clan {
directory = ./vm; directory = ./vm;
machines.jon = { machines.jon = {
@@ -29,7 +30,7 @@ let
roles.controller.machines.bam = { }; roles.controller.machines.bam = { };
}; };
}; };
}; }).config;
in in
{ {
test_peers = { test_peers = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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