From 4c1e2435551ed5e4e7b58280c9b82186795f322e Mon Sep 17 00:00:00 2001 From: mrsu Date: Sat, 29 Jun 2024 16:21:28 +0100 Subject: [PATCH] link lxd preseed to zfs volume --- hosts/common/disks/zfs/zspeed.nix | 18 +++++++++++++++--- hosts/common/optional/lxd/profiles/default.nix | 6 +++--- hosts/nebula/default.nix | 3 +++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/hosts/common/disks/zfs/zspeed.nix b/hosts/common/disks/zfs/zspeed.nix index f04e870..6edd363 100644 --- a/hosts/common/disks/zfs/zspeed.nix +++ b/hosts/common/disks/zfs/zspeed.nix @@ -1,4 +1,16 @@ -{ +{ pkgs +, lib +, ... +}: +let + }; + In your own system use something like this: + import (builtins.fetchGit { + url = "https://github.com/nix-community/disko"; + ref = "master"; + }) { + inherit lib; + };{ disko.devices = { disk = { x = { @@ -45,13 +57,13 @@ "xattr" = "sa"; "ashift" = "13"; }; - mountpoint = "/mnt/zfs"; + mountpoint = "/mnt/zpool"; postCreateHook = "zfs list -t snapshot -H -o name | grep -E '^zspeed@blank$' || zfs snapshot zspeed@blank"; datasets = { postgres = { type = "zfs_volume"; - size = "10G"; + size = "10G -s"; content = { type = "filesystem"; format = "ext4"; diff --git a/hosts/common/optional/lxd/profiles/default.nix b/hosts/common/optional/lxd/profiles/default.nix index 98e3ba4..87fd741 100644 --- a/hosts/common/optional/lxd/profiles/default.nix +++ b/hosts/common/optional/lxd/profiles/default.nix @@ -10,9 +10,9 @@ }; storage_pool = { - name = "test"; - driver = "zfs"; - config.source = "zspeed/test"; + name = "postgres"; + driver = "disk"; + config.source = "/mnt/postgres"; }; profile = { diff --git a/hosts/nebula/default.nix b/hosts/nebula/default.nix index e1e67ce..eb91028 100644 --- a/hosts/nebula/default.nix +++ b/hosts/nebula/default.nix @@ -17,6 +17,9 @@ in inputs.disko.nixosModules.disko (import ../common/disks { device = dev; impermanence = impermanence; fsType = fsType; encrypted = encrypted; }) + # Zfs disk configuration + ../common/disks/zfs/zspeed.nix + # Import core options ./hardware-configuration.nix ../common/core