| I want to leverage disko to create datasets for me post-install/initial set-up. I found this suggestion on discourse, and that works for those who've get all their disko config in 1x file (or 1x file that imports all/any other) per machine. https://discourse.nixos.org/t/add-dataset-to-pool-after-creation-in-disko/62244/2
I don't have my disko config conveniently collated into a variable like that, so I'm wondering how I can achieve something like the below w/disko (the below gives error: stack overflow; max-call-depth exceeded error)?
{
_file = ./auto-create.nix;
flake.modules.nixos."nas-2024" =
{
config,
pkgs,
lib,
...
}:
let
preStart =
# bash
''${lib.getExe pkgs.disko} --mode format ${
pkgs.writeText "disko.nix" (lib.generators.toPretty { } { inherit (config) disko; })
}'';
in
{
# Perform the "create new datasets/zvols" operation
systemd.services."zfs-import-tank".preStart = preStart;
# systemd.services."zfs-import-nvmepool".preStart = preStart; # Don't need this yet
};
}
PS: I make heavy use of https://flake.parts/options/flake-parts-modules.html, which allow me to split configuration like shown above easily across files
|