From 52f8b67bf45157e2bd2465cbabb5d6e735ea6a1d Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Fri, 16 May 2025 08:59:00 +0200 Subject: [PATCH] feat(ymir): add simple disko config. --- flake.nix | 2 ++ hosts/ymir/configuration.nix | 1 + hosts/ymir/disk-config.nix | 64 ++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 hosts/ymir/disk-config.nix diff --git a/flake.nix b/flake.nix index 44f0352..409c6ac 100644 --- a/flake.nix +++ b/flake.nix @@ -270,6 +270,8 @@ # Still no specific modules here # ./modules/cross-platform/nixos agenix.nixosModules.default + # Use disko for creating filesystem + disko.nixosModules.disko # Setup home manager for my user home-manager.nixosModules.home-manager { diff --git a/hosts/ymir/configuration.nix b/hosts/ymir/configuration.nix index ed86ac3..ffb06f3 100644 --- a/hosts/ymir/configuration.nix +++ b/hosts/ymir/configuration.nix @@ -7,6 +7,7 @@ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ./disk-config.nix inputs.home-manager.nixosModules.home-manager ]; diff --git a/hosts/ymir/disk-config.nix b/hosts/ymir/disk-config.nix new file mode 100644 index 0000000..f061911 --- /dev/null +++ b/hosts/ymir/disk-config.nix @@ -0,0 +1,64 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypt"; + passwordFile = "/tmp/secret.key"; # Interactive + settings = { + allowDiscards = true; + keyFile = "/tmp/secret.key"; + }; + content = { + type = "btrfs"; + extraArgs = ["-f"]; + subvolumes = { + "@" = { + mountpoint = "/"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "@home" = { + mountpoint = "/home"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + "@nix" = { + mountpoint = "/nix"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +}