templates: consistent templates, remove deprecated things

This commit is contained in:
Johannes Kirschbauer
2025-07-02 11:57:30 +02:00
parent a27321a826
commit f0c5a8c84a
13 changed files with 129 additions and 165 deletions

2
templates/clan/default/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
result*
.direnv/

View File

@@ -1,53 +1,42 @@
{
inputs.clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz";
inputs.nixpkgs.follows = "clan-core/nixpkgs";
inputs.flake-parts.follows = "clan-core/flake-parts";
inputs.flake-parts.inputs.nixpkgs-lib.follows = "clan-core/nixpkgs";
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
imports = [ inputs.clan-core.flakeModules.default ];
# https://docs.clan.lol/guides/getting-started/flake-parts/
clan = {
{ self, clan-core, ... }:
let
# Usage see: https://docs.clan.lol
clan = clan-core.clanLib.buildClan {
inherit self;
# Ensure this is unique among all clans you want to use.
meta.name = "__CHANGE_ME__";
# Information about your machines. Machines under ./machines will be auto-imported.
inventory.machines = {
somemachine.tags = [ "desktop" ];
somemachine.deploy.targetHost = "root@somemachine";
};
# Clan services to use. See https://docs.clan.lol/reference/clanServices
inventory.instances = {
admin = {
module = {
name = "admin";
input = "clan";
};
roles.default.tags.all = { };
roles.default.settings.allowedKeys = {
# Insert the public key of all your admin machines
# All these 'admin machines' will have ssh access to "tags.all" (all machines)
# Alternatively set 'users.users.root.openssh.authorizedKeys.keys' in each machine
"admin-machine-1" = "__YOUR_PUBLIC_KEY__";
};
};
zerotier = {
module = {
name = "zerotier";
input = "clan";
};
# Replace with the name of your machine that you will use as zerotier-controller
# See: https://docs.zerotier.com/controller/
# Deploy this machine first to create the network secrets
roles.controller.machines."__YOUR_CONTROLLER__" = { };
# Peers of the network
# tags.all means 'all machines' will joined
roles.peer.tags.all = { };
};
};
# A mapping of machine names to their nixos configuration. Allows specifying
# additional configuration.
# A mapping of machine names to their nixos configuration.
# Allows specifying additional nixos configuration.
machines = {
somemachine =
{ pkgs, ... }:
@@ -56,10 +45,33 @@
};
};
};
perSystem =
{ pkgs, inputs', ... }:
{
devShells.default = pkgs.mkShell { packages = [ inputs'.clan-core.packages.clan-cli ]; };
};
in
{
# Expose clan structures as flake outputs. clanInternals is needed for
# the clan-cli. Exposing nixosConfigurations allows using `nixos-rebuild` as before.
inherit (clan)
nixosConfigurations
nixosModules
clanInternals
darwinConfigurations
darwinModules
;
# Add the Clan cli tool to the dev shell.
# Use "nix develop" to enter the dev shell.
devShells =
clan-core.inputs.nixpkgs.lib.genAttrs
[
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
]
(system: {
default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
packages = [ clan-core.packages.${system}.clan-cli ];
};
});
};
}