2023-07-21 13:13:26 +00:00
|
|
|
{
|
2023-07-26 09:31:33 +00:00
|
|
|
description = "<Put your description here>";
|
2023-07-21 13:13:26 +00:00
|
|
|
|
2023-10-31 12:01:16 +00:00
|
|
|
inputs.clan-core.url = "git+https://git.clan.lol/clan/clan-core";
|
2023-07-21 13:13:26 +00:00
|
|
|
|
2024-03-17 18:48:49 +00:00
|
|
|
outputs =
|
|
|
|
{ self, clan-core, ... }:
|
2023-09-02 14:12:37 +00:00
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
2023-09-03 13:36:00 +00:00
|
|
|
pkgs = clan-core.inputs.nixpkgs.legacyPackages.${system};
|
2024-04-16 10:02:22 +00:00
|
|
|
# Usage see: https://docs.clan.lol
|
2023-09-21 09:40:01 +00:00
|
|
|
clan = clan-core.lib.buildClan {
|
|
|
|
directory = self;
|
2024-04-06 09:54:34 +00:00
|
|
|
clanName = "__CHANGE_ME__"; # Ensure this is internet wide unique.
|
2024-04-10 10:03:23 +00:00
|
|
|
|
2024-04-16 10:02:22 +00:00
|
|
|
# Prerequisite: boot into the installer
|
|
|
|
# See: https://docs.clan.lol/getting-started/installer
|
2024-04-07 13:59:33 +00:00
|
|
|
# local> mkdir -p ./machines/machine1
|
|
|
|
# local> Edit ./machines/machine1/configuration.nix to your liking
|
2024-04-05 11:08:32 +00:00
|
|
|
machines = {
|
2024-05-12 22:09:24 +00:00
|
|
|
# "jon" will be the hostname of the machine
|
2024-04-06 09:54:34 +00:00
|
|
|
jon = {
|
2024-04-05 11:08:32 +00:00
|
|
|
imports = [
|
2024-04-13 13:53:12 +00:00
|
|
|
./modules/shared.nix
|
2024-04-06 09:54:34 +00:00
|
|
|
./machines/jon/configuration.nix
|
2024-04-09 07:17:20 +00:00
|
|
|
];
|
2024-04-07 13:59:33 +00:00
|
|
|
|
2024-04-13 14:00:01 +00:00
|
|
|
nixpkgs.hostPlatform = system;
|
|
|
|
|
2024-04-10 10:03:23 +00:00
|
|
|
# Set this for clan commands use ssh i.e. `clan machines update`
|
2024-05-12 22:09:24 +00:00
|
|
|
# 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
|
2024-04-10 10:03:23 +00:00
|
|
|
clan.networking.targetHost = pkgs.lib.mkDefault "root@jon";
|
2024-04-05 11:08:32 +00:00
|
|
|
|
2024-05-10 13:39:46 +00:00
|
|
|
# ssh root@flash-installer.local lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|
|
|
disko.devices.disk.main = {
|
2024-04-10 10:03:23 +00:00
|
|
|
device = "/dev/disk/by-id/__CHANGE_ME__";
|
2024-04-09 07:17:20 +00:00
|
|
|
};
|
2024-04-10 10:03:23 +00:00
|
|
|
|
2024-05-12 21:09:08 +00:00
|
|
|
# IMPORTANT! Add your SSH key here
|
|
|
|
# e.g. > cat ~/.ssh/id_ed25519.pub
|
2024-05-14 16:29:04 +00:00
|
|
|
users.users.root.openssh.authorizedKeys.keys = throw ''
|
|
|
|
Don't forget to add your SSH key here!
|
|
|
|
users.users.root.openssh.authorizedKeys.keys = [ "<YOUR SSH_KEY>" ]
|
|
|
|
'';
|
2024-05-12 21:09:08 +00:00
|
|
|
|
|
|
|
# Zerotier needs one controller to accept new nodes. Once accepted
|
|
|
|
# the controller can be offline and routing still works.
|
2024-04-10 10:03:23 +00:00
|
|
|
clan.networking.zerotier.controller.enable = true;
|
2024-04-05 11:08:32 +00:00
|
|
|
};
|
2024-05-12 22:09:24 +00:00
|
|
|
# "sara" will be the hostname of the machine
|
2024-04-06 09:54:34 +00:00
|
|
|
sara = {
|
2024-04-05 11:08:32 +00:00
|
|
|
imports = [
|
2024-04-13 13:53:12 +00:00
|
|
|
./modules/shared.nix
|
2024-04-06 09:54:34 +00:00
|
|
|
./machines/sara/configuration.nix
|
2024-04-09 07:17:20 +00:00
|
|
|
];
|
2024-04-13 13:53:12 +00:00
|
|
|
|
2024-04-13 14:00:01 +00:00
|
|
|
nixpkgs.hostPlatform = system;
|
|
|
|
|
2024-04-10 10:03:23 +00:00
|
|
|
# Set this for clan commands use ssh i.e. `clan machines update`
|
2024-05-12 22:09:24 +00:00
|
|
|
# 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
|
2024-04-10 10:03:23 +00:00
|
|
|
clan.networking.targetHost = pkgs.lib.mkDefault "root@sara";
|
2024-04-05 11:08:32 +00:00
|
|
|
|
2024-05-10 13:39:46 +00:00
|
|
|
# ssh root@flash-installer.local lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT
|
|
|
|
disko.devices.disk.main = {
|
2024-04-10 10:03:23 +00:00
|
|
|
device = "/dev/disk/by-id/__CHANGE_ME__";
|
2024-04-09 07:17:20 +00:00
|
|
|
};
|
2024-05-12 21:09:08 +00:00
|
|
|
|
|
|
|
# IMPORTANT! Add your SSH key here
|
|
|
|
# e.g. > cat ~/.ssh/id_ed25519.pub
|
2024-05-14 16:29:04 +00:00
|
|
|
users.users.root.openssh.authorizedKeys.keys = throw ''
|
|
|
|
Don't forget to add your SSH key here!
|
|
|
|
users.users.root.openssh.authorizedKeys.keys = [ "<YOUR SSH_KEY>" ]
|
|
|
|
'';
|
2024-05-12 21:09:08 +00:00
|
|
|
|
2024-04-13 14:29:24 +00:00
|
|
|
/*
|
2024-04-13 13:53:12 +00:00
|
|
|
After jon is deployed, uncomment the following line
|
|
|
|
This will allow sara to share the VPN overlay network with jon
|
2024-04-30 17:37:03 +00:00
|
|
|
The networkId is generated by the first deployment of jon
|
2024-04-13 13:53:12 +00:00
|
|
|
*/
|
2024-04-10 10:03:23 +00:00
|
|
|
# clan.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id;
|
2024-04-05 11:08:32 +00:00
|
|
|
};
|
|
|
|
};
|
2023-09-21 09:40:01 +00:00
|
|
|
};
|
2023-09-02 14:12:37 +00:00
|
|
|
in
|
|
|
|
{
|
2024-05-27 13:54:17 +00:00
|
|
|
# all machines managed by Clan
|
2023-09-21 09:40:01 +00:00
|
|
|
inherit (clan) nixosConfigurations clanInternals;
|
2024-05-27 13:54:17 +00:00
|
|
|
# add the Clan cli tool to the dev shell
|
2023-09-02 14:12:37 +00:00
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
2024-03-17 18:48:49 +00:00
|
|
|
packages = [ clan-core.packages.${system}.clan-cli ];
|
2023-09-02 14:12:37 +00:00
|
|
|
};
|
2023-07-21 13:13:26 +00:00
|
|
|
};
|
|
|
|
}
|