Update new-clan template
This commit is contained in:
committed by
Johannes Kirschbauer
parent
2dd1e31e97
commit
7ad7c3f859
@@ -8,25 +8,59 @@
|
|||||||
# Usage see: https://docs.clan.lol
|
# Usage see: https://docs.clan.lol
|
||||||
clan = clan-core.clanLib.buildClan {
|
clan = clan-core.clanLib.buildClan {
|
||||||
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__";
|
||||||
|
|
||||||
# All machines in ./machines will be imported.
|
# Information about your machines. Machines under ./machines will be auto-imported.
|
||||||
|
inventory.machines = {
|
||||||
|
somemachine.tags = [ "desktop" ];
|
||||||
|
somemachine.deploy.targetHost = "root@somemachine";
|
||||||
|
};
|
||||||
|
|
||||||
# Prerequisite: boot into the installer.
|
# Clan services to use. See https://docs.clan.lol/reference/clanServices
|
||||||
# See: https://docs.clan.lol/guides/getting-started/installer
|
inventory.instances = {
|
||||||
# local> mkdir -p ./machines/machine1
|
|
||||||
# local> Edit ./machines/<machine>/configuration.nix to your liking.
|
admin = {
|
||||||
|
module = {
|
||||||
|
name = "admin";
|
||||||
|
input = "clan";
|
||||||
|
};
|
||||||
|
roles.default.tags.all = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
zerotier = {
|
||||||
|
module = {
|
||||||
|
name = "zerotier";
|
||||||
|
input = "clan";
|
||||||
|
};
|
||||||
|
roles.peer.tags.all = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# A mapping of machine names to their nixos configuration. Allows specifying
|
||||||
|
# additional configuration.
|
||||||
machines = {
|
machines = {
|
||||||
# You can also specify additional machines here.
|
somemachine =
|
||||||
# somemachine = {
|
{ pkgs, ... }:
|
||||||
# imports = [ ./some-machine/configuration.nix ];
|
{
|
||||||
# }
|
environment.systemPackages = with pkgs; [ asciinema ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
inherit (clan) nixosConfigurations nixosModules clanInternals;
|
|
||||||
|
# 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.
|
# 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 =
|
||||||
|
|||||||
0
templates/clan/new-clan/machines/.gitkeep
Normal file
0
templates/clan/new-clan/machines/.gitkeep
Normal file
@@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
imports = [
|
|
||||||
# contains your disk format and partitioning configuration.
|
|
||||||
../../modules/disko.nix
|
|
||||||
# this file is shared among all machines
|
|
||||||
../../modules/shared.nix
|
|
||||||
# enables GNOME desktop (optional)
|
|
||||||
../../modules/gnome.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# This is your user login name.
|
|
||||||
users.users.user.name = "<your-username>";
|
|
||||||
|
|
||||||
# Set this for clan commands use ssh i.e. `clan machines update`
|
|
||||||
# If you change the hostname, you need to update this line to root@<new-hostname>
|
|
||||||
# This only works however if you have avahi running on your admin machine else use IP
|
|
||||||
clan.core.networking.targetHost = "root@<IP>";
|
|
||||||
|
|
||||||
# You can get your disk id by running the following command on the installer:
|
|
||||||
# Replace <IP> with the IP of the installer printed on the screen or by running the `ip addr` command.
|
|
||||||
# ssh root@<IP> lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|
||||||
disko.devices.disk.main.device = "/dev/disk/by-id/__CHANGE_ME__";
|
|
||||||
|
|
||||||
# IMPORTANT! Add your SSH key here
|
|
||||||
# e.g. > cat ~/.ssh/id_ed25519.pub
|
|
||||||
users.users.root.openssh.authorizedKeys.keys = [
|
|
||||||
''
|
|
||||||
__YOUR_SSH_KEY__
|
|
||||||
''
|
|
||||||
];
|
|
||||||
|
|
||||||
# Zerotier needs one controller to accept new nodes. Once accepted
|
|
||||||
# the controller can be offline and routing still works.
|
|
||||||
clan.core.networking.zerotier.controller.enable = true;
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
{
|
|
||||||
imports = [
|
|
||||||
../../modules/disko.nix
|
|
||||||
../../modules/shared.nix
|
|
||||||
# enables GNOME desktop (optional)
|
|
||||||
../../modules/gnome.nix
|
|
||||||
];
|
|
||||||
# Put your username here for login
|
|
||||||
users.users.user.name = "<your-username>";
|
|
||||||
|
|
||||||
# Set this for clan commands use ssh i.e. `clan machines update`
|
|
||||||
# If you change the hostname, you need to update this line to root@<new-hostname>
|
|
||||||
# This only works however if you have avahi running on your admin machine else use IP
|
|
||||||
clan.core.networking.targetHost = "root@<IP>";
|
|
||||||
|
|
||||||
# You can get your disk id by running the following command on the installer:
|
|
||||||
# Replace <IP> with the IP of the installer printed on the screen or by running the `ip addr` command.
|
|
||||||
# ssh root@<IP> lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|
||||||
disko.devices.disk.main.device = "/dev/disk/by-id/__CHANGE_ME__";
|
|
||||||
|
|
||||||
# IMPORTANT! Add your SSH key here
|
|
||||||
# e.g. > cat ~/.ssh/id_ed25519.pub
|
|
||||||
users.users.root.openssh.authorizedKeys.keys = [
|
|
||||||
''
|
|
||||||
__YOUR_SSH_KEY__
|
|
||||||
''
|
|
||||||
];
|
|
||||||
/*
|
|
||||||
After jon is deployed, uncomment the following line
|
|
||||||
This will allow sara to share the VPN overlay network with jon
|
|
||||||
The networkId is generated by the first deployment of jon
|
|
||||||
*/
|
|
||||||
# clan.core.networking.zerotier.networkId = builtins.readFile ../../vars/per-machine/jon/zerotier/zerotier-network-id/value;
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
clan-core,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
suffix = config.clan.core.vars.generators.disk-id.files.diskId.value;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
clan-core.clanModules.disk-id
|
|
||||||
];
|
|
||||||
|
|
||||||
# DO NOT EDIT THIS FILE AFTER INSTALLATION of a machine
|
|
||||||
# Otherwise your system might not boot because of missing partitions / filesystems
|
|
||||||
boot.loader.grub.efiSupport = lib.mkDefault true;
|
|
||||||
boot.loader.grub.efiInstallAsRemovable = lib.mkDefault true;
|
|
||||||
disko.devices = {
|
|
||||||
disk = {
|
|
||||||
"main" = {
|
|
||||||
# suffix is to prevent disk name collisions
|
|
||||||
name = "main-" + suffix;
|
|
||||||
type = "disk";
|
|
||||||
# Set the following in flake.nix for each maschine:
|
|
||||||
# device = <uuid>;
|
|
||||||
content = {
|
|
||||||
type = "gpt";
|
|
||||||
partitions = {
|
|
||||||
"boot" = {
|
|
||||||
size = "1M";
|
|
||||||
type = "EF02"; # for grub MBR
|
|
||||||
priority = 1;
|
|
||||||
};
|
|
||||||
"ESP" = {
|
|
||||||
size = "512M";
|
|
||||||
type = "EF00";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "vfat";
|
|
||||||
mountpoint = "/boot";
|
|
||||||
mountOptions = [ "nofail" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
"root" = {
|
|
||||||
size = "100%";
|
|
||||||
content = {
|
|
||||||
type = "filesystem";
|
|
||||||
format = "ext4";
|
|
||||||
# format = "btrfs";
|
|
||||||
# format = "bcachefs";
|
|
||||||
mountpoint = "/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
services.xserver.enable = true;
|
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
|
||||||
services.xserver.displayManager.gdm.enable = true;
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
clan-core,
|
|
||||||
# Optional, if you want to access other flakes:
|
|
||||||
# self,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
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
|
|
||||||
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
|
|
||||||
services.avahi.enable = true;
|
|
||||||
|
|
||||||
# generate a random password for our user below
|
|
||||||
# can be read using `clan secrets get <machine-name>-user-password` command
|
|
||||||
clan.user-password.user = "user";
|
|
||||||
users.users.user = {
|
|
||||||
isNormalUser = true;
|
|
||||||
extraGroups = [
|
|
||||||
"wheel"
|
|
||||||
"networkmanager"
|
|
||||||
"video"
|
|
||||||
"input"
|
|
||||||
];
|
|
||||||
uid = 1000;
|
|
||||||
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user