add inputs to specialArgs and make templates use it.

This commit is contained in:
Jörg Thalheim
2025-05-30 19:22:32 +02:00
parent 9d62001a27
commit 646a3d56ce
5 changed files with 23 additions and 15 deletions

View File

@@ -189,6 +189,10 @@ in
./computed-tags.nix ./computed-tags.nix
]; ];
specialArgs = {
self = lib.mkDefault config.self;
};
# Ready to use configurations # Ready to use configurations
# These are only shallow wrapping the 'nixosModules' or 'darwinModules' with # These are only shallow wrapping the 'nixosModules' or 'darwinModules' with
# lib.nixosSystem # lib.nixosSystem

View File

@@ -22,12 +22,6 @@
clan = { clan = {
meta.name = "__CHANGE_ME__"; # Ensure this is unique among all clans you want to use. meta.name = "__CHANGE_ME__"; # Ensure this is unique among all clans you want to use.
# This makes flake inputs available in NixOS modules.
specialArgs = {
self = self;
inputs = self.inputs;
};
inherit self; inherit self;
machines = { machines = {
# "jon" will be the hostname of the machine # "jon" will be the hostname of the machine

View File

@@ -1,7 +1,14 @@
{ clan-core, ... }: {
clan-core,
# Optional, if you want to access other flakes:
# self,
...
}:
{ {
imports = [ imports = [
clan-core.clanModules.sshd clan-core.clanModules.sshd
clan-core.clanModules.root-password clan-core.clanModules.root-password
# You can access other flakes imported in your flake via `self` like this:
# self.inputs.nix-index-database.nixosModules.nix-index
]; ];
} }

View File

@@ -3,7 +3,7 @@
inputs.nixpkgs.follows = "clan-core/nixpkgs"; inputs.nixpkgs.follows = "clan-core/nixpkgs";
outputs = outputs =
{ self, clan-core, ... } @ inputs: { 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.clanLib.buildClan {
@@ -11,12 +11,6 @@
# 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__";
# This makes flake inputs available in NixOS modules.
specialArgs = {
self = self;
inputs = inputs;
};
# All machines in ./machines will be imported. # All machines in ./machines will be imported.
# Prerequisite: boot into the installer. # Prerequisite: boot into the installer.

View File

@@ -1,4 +1,10 @@
{ config, clan-core, ... }: {
config,
clan-core,
# Optional, if you want to access other flakes:
# self,
...
}:
{ {
imports = [ imports = [
# Enables the OpenSSH server for remote access # Enables the OpenSSH server for remote access
@@ -7,6 +13,9 @@
clan-core.clanModules.root-password clan-core.clanModules.root-password
clan-core.clanModules.user-password clan-core.clanModules.user-password
clan-core.clanModules.state-version clan-core.clanModules.state-version
# You can access other flakes imported in your flake via `self` like this:
# self.inputs.nix-index-database.nixosModules.nix-index
]; ];
# Locale service discovery and mDNS # Locale service discovery and mDNS