From 1fc4739ee33b732f87f9d0bd38e5bf8fb71c4cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 5 Apr 2024 13:08:32 +0200 Subject: [PATCH] improve starter template --- templates/new-clan/flake.nix | 39 ++++++++++++++++++++++++++++ templates/new-clan/modules/disko.nix | 36 +++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 templates/new-clan/modules/disko.nix diff --git a/templates/new-clan/flake.nix b/templates/new-clan/flake.nix index 2f34b17c..315a88dd 100644 --- a/templates/new-clan/flake.nix +++ b/templates/new-clan/flake.nix @@ -11,6 +11,45 @@ clan = clan-core.lib.buildClan { directory = self; clanName = "__CHANGE_ME__"; + machines = { + machine1 = { + nixpkgs.hostPlatform = system; + imports = [ + # TODO: boot into the installer + # remote> nixos-generate-config --root /tmp/config --no-filesystems + # local> mkdir -p ./machines/machine1 + # local> scp -r root@machine1:/tmp/config ./machines/machine1 + # local> Edit ./machines/machine1/configuration.nix to your liking + ./modules/disko.nix + clan-core.clanModules.sshd + { + # Set this for clan commands use ssh i.e. `clan machines update` + clan.networking.targetHost = pkgs.lib.mkDefault "root@"; + # remote> lsblk --output NAME,PTUUID,FSTYPE,SIZE,MOUNTPOINT + + config.disko.devices.disk.main.device = "/dev/disk/by-id/__CHANGE_ME__"; + + clan.networking.zerotier.controller.enable = true; + } + ]; + }; + machine2 = { + nixpkgs.hostPlatform = system; + imports = [ + # ./machines/machine2/configuration.nix + ./modules/disko.nix + clan-core.clanModules.sshd + { + # Set this for clan commands use ssh i.e. `clan machines update` + clan.networking.targetHost = pkgs.lib.mkDefault "root@"; + + config.disko.devices.disk.main.device = "/dev/disk/by-id/__CHANGE_ME__"; + # local> clan facts generate + clan.networking.zerotier.networkId = builtins.readFile ./machines/machine1/facts/zerotier-network-id; + } + ]; + }; + }; }; in { diff --git a/templates/new-clan/modules/disko.nix b/templates/new-clan/modules/disko.nix new file mode 100644 index 00000000..ba8700b6 --- /dev/null +++ b/templates/new-clan/modules/disko.nix @@ -0,0 +1,36 @@ +{ + config.disko.devices = { + disk = { + main = { + type = "disk"; + device = throw "Change this to your disk device"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + type = "EF02"; # for grub MBR + }; + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +}