templates: makes template working

This commit is contained in:
Johannes Kirschbauer
2024-04-10 12:03:23 +02:00
parent 39a946e564
commit 15be88f265
5 changed files with 72 additions and 26 deletions

View File

@@ -12,24 +12,25 @@
directory = self; directory = self;
clanName = "__CHANGE_ME__"; # Ensure this is internet wide unique. clanName = "__CHANGE_ME__"; # Ensure this is internet wide unique.
clanIcon = null; # Optional, a path to an image file clanIcon = null; # Optional, a path to an image file
# TODO: boot into the installer # Prerequisite: boot into the installer
# remote> nixos-generate-config --root /tmp/config --no-filesystems
# local> mkdir -p ./machines/machine1 # local> mkdir -p ./machines/machine1
# local> scp -r root@machine1:/tmp/config ./machines/machine1
# local> Edit ./machines/machine1/configuration.nix to your liking # local> Edit ./machines/machine1/configuration.nix to your liking
machines = { machines = {
jon = { jon = {
nixpkgs.hostPlatform = system;
imports = [ imports = [
./machines/jon/configuration.nix ./machines/jon/configuration.nix
./machines/jon/hardware-configuration.nix
clan-core.clanModules.sshd clan-core.clanModules.sshd
clan-core.clanModules.diskLayouts clan-core.clanModules.diskLayouts
clan-core.clanModules.root-password
]; ];
config = {
nixpkgs.hostPlatform = system;
clanCore.machineIcon = null; # Optional, a path to an image file clanCore.machineIcon = null; # Optional, a path to an image file
# Set this for clan commands use ssh i.e. `clan machines update` # Set this for clan commands use ssh i.e. `clan machines update`
clan.networking.targetHost = pkgs.lib.mkDefault "root@<IP_ADDRESS>"; clan.networking.targetHost = pkgs.lib.mkDefault "root@jon";
# TODO: Example how to use disko for more complicated setups # TODO: Example how to use disko for more complicated setups
@@ -38,31 +39,34 @@
device = "/dev/disk/by-id/__CHANGE_ME__"; device = "/dev/disk/by-id/__CHANGE_ME__";
}; };
services.getty.autologinUser = "root";
# TODO: Document that there needs to be one controller # TODO: Document that there needs to be one controller
clan.networking.zerotier.controller.enable = true; clan.networking.zerotier.controller.enable = true;
}; };
};
sara = { sara = {
nixpkgs.hostPlatform = system;
imports = [ imports = [
./machines/sara/configuration.nix ./machines/sara/configuration.nix
./machines/jon/hardware-configuration.nix
clan-core.clanModules.sshd clan-core.clanModules.sshd
clan-core.clanModules.diskLayouts clan-core.clanModules.diskLayouts
clan-core.clanModules.root-password
]; ];
config = { nixpkgs.hostPlatform = system;
clanCore.machineIcon = null; # Optional, a path to an image file clanCore.machineIcon = null; # Optional, a path to an image file
# Set this for clan commands use ssh i.e. `clan machines update` # Set this for clan commands use ssh i.e. `clan machines update`
clan.networking.targetHost = pkgs.lib.mkDefault "root@<IP_ADDRESS>"; clan.networking.targetHost = pkgs.lib.mkDefault "root@sara";
# local> clan facts generate # local> clan facts generate
# remote> lsblk --output NAME,PTUUID,FSTYPE,SIZE,MOUNTPOINT
clan.diskLayouts.singleDiskExt4 = { clan.diskLayouts.singleDiskExt4 = {
device = "/dev/disk/by-id/__CHANGE_ME__"; device = "/dev/disk/by-id/__CHANGE_ME__";
}; };
};
clan.networking.zerotier.networking.enable = true;
# After jon is deployed, uncomment the following line
# This will allow sara to share the VPN overlay network with jon
# clan.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id;
}; };
}; };
}; };

View File

@@ -1,4 +1,15 @@
{ ... }: { ... }:
{ {
users.users.root.openssh.authorizedKeys.keys = [
# IMPORTANT! Add your SSH key here
# e.g. > cat ~/.ssh/id_ed25519.pub
"<YOUR SSH_KEY>"
];
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm.enable = true;
# Disable the default gnome apps to speed up deployment
services.gnome.core-utilities.enable = false;
} }

View File

@@ -0,0 +1,10 @@
# Replace this file with an actual hardware-configuration.nix!
throw ''
Did you forget to generate your hardware config?
Run the following command:
'ssh root@<hostname> nixos-generate-config --no-filesystems --show-hardware-config > hardware-configuration.nix'
Then replace this file with the generated "hardware-configuration.nix".
''

View File

@@ -1,4 +1,15 @@
{ ... }: { ... }:
{ {
users.users.root.openssh.authorizedKeys.keys = [
# IMPORTANT! Add your SSH key here
# e.g. > cat ~/.ssh/id_ed25519.pub
"<YOUR SSH_KEY>"
];
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm.enable = true;
# Disable the default gnome apps to speed up deployment
services.gnome.core-utilities.enable = false;
} }

View File

@@ -0,0 +1,10 @@
# Replace this file with an actual hardware-configuration.nix!
throw ''
Did you forget to generate your hardware config?
Run the following command:
'ssh root@<hostname> nixos-generate-config --no-filesystems --show-hardware-config > hardware-configuration.nix'
Then replace this file with the generated "hardware-configuration.nix".
''