Merge pull request 'modules: clean up clan module' (#5679) from role-settings into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5679
This commit is contained in:
hsjobeki
2025-10-28 08:22:46 +00:00
9 changed files with 35 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ in
../../clanServices/syncthing ../../clanServices/syncthing
# Required modules # Required modules
../../nixosModules/clanCore ../../nixosModules/clanCore
../../nixosModules/machineModules
# Dependencies like clan-cli # Dependencies like clan-cli
../../pkgs/clan-cli ../../pkgs/clan-cli
]; ];

View File

@@ -21,6 +21,7 @@ in
../../clanServices/zerotier ../../clanServices/zerotier
# Required modules # Required modules
../../nixosModules/clanCore ../../nixosModules/clanCore
../../nixosModules/machineModules
# Dependencies like clan-cli # Dependencies like clan-cli
../../pkgs/clan-cli ../../pkgs/clan-cli
]; ];

View File

@@ -21,6 +21,7 @@ in
../../../flakeModules ../../../flakeModules
../../../lib ../../../lib
../../../nixosModules/clanCore ../../../nixosModules/clanCore
../../../nixosModules/machineModules
../../../machines ../../../machines
../../../inventory.json ../../../inventory.json
../../../modules ../../../modules

View File

@@ -6,7 +6,7 @@
inherit (clan-core) clanLib; inherit (clan-core) clanLib;
}; };
imports = [ imports = [
./top-level-interface.nix
./module.nix ./module.nix
./interface.nix
]; ];
} }

View File

@@ -100,7 +100,7 @@ let
_: machine: _: machine:
machine.extendModules { machine.extendModules {
modules = [ modules = [
(lib.modules.importApply ../machineModules/overridePkgs.nix { (lib.modules.importApply ../../nixosModules/machineModules/overridePkgs.nix {
pkgs = pkgsFor.${system}; pkgs = pkgsFor.${system};
}) })
]; ];
@@ -167,6 +167,9 @@ in
{ ... }@args: { ... }@args:
let let
_class = _class =
# _class was added in https://github.com/NixOS/nixpkgs/pull/395141
# Clan relies on it to determine which modules to load
# people need to use at least that version of nixpkgs
args._class or (throw '' args._class or (throw ''
Your version of nixpkgs is incompatible with the latest clan. Your version of nixpkgs is incompatible with the latest clan.
Please update nixpkgs input to the latest nixos-unstable or nixpkgs-unstable. Please update nixpkgs input to the latest nixos-unstable or nixpkgs-unstable.
@@ -176,7 +179,7 @@ in
in in
{ {
imports = [ imports = [
(lib.modules.importApply ../machineModules/forName.nix { (lib.modules.importApply ../../nixosModules/machineModules/forName.nix {
inherit (config.inventory) meta; inherit (config.inventory) meta;
inherit inherit
name name

View File

@@ -1,3 +1,28 @@
/**
The templates submodule
'clan.templates'
Different kinds supported:
- clan templates: 'clan.templates.clan'
- disko templates: 'clan.templates.disko'
- machine templates: 'clan.templates.machine'
A template has the form:
```nix
{
description: string; # short summary what the template contains
path: path; # path to the template
}
```
The clan API copies the template from the given 'path'
into a target folder. For example,
`./machines/<machine-name>` for 'machine' templates.
*/
{ {
lib, lib,
... ...

View File

@@ -3,6 +3,7 @@
directory, directory,
meta, meta,
}: }:
# The following is a nixos/darwin module
{ {
_class, _class,
lib, lib,