From 56fad0fd4ad90b0c0e2ba1a07d41fda7f4318197 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 30 Apr 2024 19:16:13 +0200 Subject: [PATCH] template: use disko module direcly --- docs/site/getting-started/configure.md | 12 ++++++-- docs/site/getting-started/flake-parts.md | 3 +- templates/new-clan/flake.nix | 3 +- templates/new-clan/modules/disko.nix | 37 ++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 templates/new-clan/modules/disko.nix diff --git a/docs/site/getting-started/configure.md b/docs/site/getting-started/configure.md index 9358500d..39b78bc9 100644 --- a/docs/site/getting-started/configure.md +++ b/docs/site/getting-started/configure.md @@ -89,6 +89,10 @@ Adding or configuring a new machine requires two simple steps: # ... machines = { "jon" = { + imports = [ + # ... + ./modules/disko.nix + ]; # ... # Change this to the correct ip-address or hostname @@ -96,7 +100,7 @@ Adding or configuring a new machine requires two simple steps: clan.networking.targetHost = pkgs.lib.mkDefault "root@" # Change this to the ID-LINK of the desired disk shown by 'lsblk' - clan.diskLayouts.singleDiskExt4 = { + disko.devices.disk.main = { device = "/dev/disk/by-id/__CHANGE_ME__"; } @@ -115,6 +119,10 @@ Adding or configuring a new machine requires two simple steps: # ... machines = { "jon" = { + imports = [ + # ... + ./modules/disko.nix + ]; # ... # Change this to the correct ip-address or hostname @@ -122,7 +130,7 @@ Adding or configuring a new machine requires two simple steps: clan.networking.targetHost = pkgs.lib.mkDefault "root@" # Change this to the ID-LINK of the desired disk shown by 'lsblk' - clan.diskLayouts.singleDiskExt4 = { + disko.devices.disk.main = { device = "/dev/disk/by-id/__CHANGE_ME__"; } diff --git a/docs/site/getting-started/flake-parts.md b/docs/site/getting-started/flake-parts.md index eb642923..46b302c0 100644 --- a/docs/site/getting-started/flake-parts.md +++ b/docs/site/getting-started/flake-parts.md @@ -69,6 +69,7 @@ Below is a guide on how to structure this in your flake.nix: jon = { imports = [ ./machines/jon/configuration.nix + ./modules/disko.nix # ... more modules ]; nixpkgs.hostPlatform = "x86_64-linux"; @@ -78,7 +79,7 @@ Below is a guide on how to structure this in your flake.nix: clan.networking.targetHost = pkgs.lib.mkDefault "root@jon"; # remote> lsblk --output NAME,ID-LINK,FSTYPE,SIZE,MOUNTPOINT - clan.diskLayouts.singleDiskExt4 = { + disko.devices.disk.main = { device = "/dev/disk/by-id/nvme-eui.e8238fa6bf530001001b448b4aec2929"; }; diff --git a/templates/new-clan/flake.nix b/templates/new-clan/flake.nix index 5f5ccd8a..65b5f650 100644 --- a/templates/new-clan/flake.nix +++ b/templates/new-clan/flake.nix @@ -45,6 +45,7 @@ sara = { imports = [ ./modules/shared.nix + ./modules/disko.nix ./machines/sara/configuration.nix ]; @@ -58,7 +59,7 @@ # local> clan facts generate # remote> lsblk --output NAME,PTUUID,FSTYPE,SIZE,MOUNTPOINT - clan.diskLayouts.singleDiskExt4 = { + disko.devices.disk.main = { device = "/dev/disk/by-id/__CHANGE_ME__"; }; diff --git a/templates/new-clan/modules/disko.nix b/templates/new-clan/modules/disko.nix new file mode 100644 index 00000000..1eb38702 --- /dev/null +++ b/templates/new-clan/modules/disko.nix @@ -0,0 +1,37 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + # Set the following in flake.nix for each maschine: + # 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 = "/"; + }; + }; + }; + }; + }; + }; + }; +}