Merge pull request 'templates/flake-parts: remove importing clanModules' (#4300) from templates-2 into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4300
This commit is contained in:
hsjobeki
2025-07-11 13:53:37 +00:00
8 changed files with 67 additions and 49 deletions

View File

@@ -23,7 +23,19 @@
type = lib.types.bool;
default = true;
example = false;
description = "Whether the user should be prompted.";
description = ''
Whether the user should be prompted for a password.
Effects:
- *enabled* (`true`) - Prompt for a passwort during the machine installation or update workflow.
- *disabled* (`false`) - Generate a passwort during the machine installation or update workflow.
The password can be shown in two steps:
- `clan vars list <machine-name>`
- `clan vars get <machine-name> <name-of-password-variable>`
'';
};
groups = lib.mkOption {
type = lib.types.listOf lib.types.str;

View File

@@ -35,10 +35,10 @@
};
# Additional NixOS configuration can be added here.
# machines/machine1/configuration.nix will be automatically imported.
# machines/jon/configuration.nix will be automatically imported.
# See: https://docs.clan.lol/guides/more-machines/#automatic-registration
machines = {
# machine1 = { config, ... }: {
# jon = { config, ... }: {
# environment.systemPackages = [ pkgs.asciinema ];
# };
};

View File

@@ -1,19 +1,25 @@
/*
This is an example of a simple nixos module:
Enables the GNOME desktop environment and the GDM display manager.
To use this module, import it in your machines NixOS configuration like this:
```nix
imports = [
modules/gnome.nix
];
```
*/
{ ... }:
{
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm.enable = true;
# Can be imported into machines to enable GNOME and GDM.
#
# Copy this into a machine's configuration:
# `machines/<name>/configuration.nix`
# ```nix
# imports = [
# ../../modules/gnome.nix
# ];
# ```
# Uncomment one block to enable the
# GNOME desktop environment and the GDM display manager.
# Pre NixOS 25.11
# services.xserver.enable = true;
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# As of NixOS 25.11
# services.displayManager.gdm.enable = true;
# services.desktopManager.gnome.enable = true;
}

View File

@@ -1,5 +1,4 @@
{
config,
clan-core,
# Optional, if you want to access other flakes:
# self,
@@ -7,14 +6,7 @@
}:
{
imports = [
# Enables the OpenSSH server for remote access
clan-core.clanModules.sshd
# Set a root password
clan-core.clanModules.root-password
clan-core.clanModules.user-password
# 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
@@ -32,6 +24,5 @@
"input"
];
uid = 1000;
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
};
}

View File

@@ -0,0 +1,23 @@
{ ... }:
{
# Can be imported into machines to enable GNOME and GDM.
#
# Copy this into a machine's configuration:
# `machines/<name>/configuration.nix`
# ```nix
# imports = [
# ../../modules/gnome.nix
# ];
# ```
# Enable the GNOME desktop environment and the GDM display manager.
# Pre NixOS: 25.11
# services.xserver.enable = true;
# services.xserver.displayManager.gdm.enable = true;
# services.xserver.desktopManager.gnome.enable = true;
# => 25.11
# services.displayManager.gdm.enable = true;
# services.desktopManager.gnome.enable = true;
}

View File

@@ -1,14 +0,0 @@
{
clan-core,
# Optional, if you want to access other flakes:
# self,
...
}:
{
imports = [
clan-core.clanModules.sshd
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,10 +3,15 @@
inputs.nixpkgs.follows = "clan-core/nixpkgs";
outputs =
{ self, clan-core, ... }:
inputs@{ self, clan-core, ... }:
let
# Usage see: https://docs.clan.lol
clan = clan-core.lib.clan { inherit self; };
clan = clan-core.lib.clan {
inherit self;
# Change this to your clan name
# Setting a name is required
meta.name = inputs.nixpkgs.lib.mkDefault "__clan__";
};
in
{
# all machines managed by Clan

View File

@@ -1,5 +0,0 @@
{
"meta": { "name": "__CHANGE_ME__" },
"machines": {},
"services": {}
}