From 458b8092dc03c3763a4569d67a952b8f278707a5 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 23 Feb 2024 07:25:44 +0800 Subject: [PATCH] hosts/plover: make disko as a dedicated NixOS module --- configs/nixos/plover/default.nix | 7 +-- configs/nixos/plover/disko.nix | 81 ++++++++++++++++---------------- 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/configs/nixos/plover/default.nix b/configs/nixos/plover/default.nix index a286c671..49d6f45b 100644 --- a/configs/nixos/plover/default.nix +++ b/configs/nixos/plover/default.nix @@ -14,6 +14,8 @@ "${foodogsquaredModulesPath}/profiles/headless.nix" "${foodogsquaredModulesPath}/profiles/hardened.nix" + ./disko.nix + ./modules ]; @@ -37,11 +39,6 @@ wireguard.enable = true; }; - # Automatic format and partitioning. - disko.devices = import ./disko.nix { - disks = [ "/dev/sda" ]; - }; - # Offline SSH!?! programs.mosh.enable = true; diff --git a/configs/nixos/plover/disko.nix b/configs/nixos/plover/disko.nix index 3b6748e1..a05b808f 100644 --- a/configs/nixos/plover/disko.nix +++ b/configs/nixos/plover/disko.nix @@ -1,47 +1,48 @@ -{ disks ? [ "/dev/sda" ], ... }: +{ config, lib, ... }: { - disk.sda = { - device = builtins.elemAt disks 0; - type = "disk"; - content = { - format = "gpt"; - type = "table"; - partitions = [ - { - name = "boot"; - start = "0"; - end = "1MiB"; - part-type = "primary"; - flags = [ "bios_grub" ]; - } + disko.devices = { + disk.sda = { + device = [ "/dev/sda" ]; + type = "disk"; + content = { + type = "gpt"; + partitions = [ + { + name = "boot"; + start = "0"; + end = "1MiB"; + part-type = "primary"; + flags = [ "bios_grub" ]; + } - { - name = "ESP"; - start = "1MiB"; - end = "256MiB"; - bootable = true; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - flags = [ "esp" ]; - } + { + name = "ESP"; + start = "1MiB"; + end = "256MiB"; + bootable = true; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + flags = [ "esp" ]; + } - { - name = "root"; - start = "256MiB"; - end = "100%"; - part-type = "primary"; - bootable = true; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - } - ]; + { + name = "root"; + start = "256MiB"; + end = "100%"; + part-type = "primary"; + bootable = true; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + } + ]; + }; }; }; }