From 4444751300a88d46c82aac6baaf4f1ea9c287830 Mon Sep 17 00:00:00 2001 From: matthewcroughan Date: Sun, 19 May 2024 13:11:09 +0100 Subject: [PATCH] make-disk-image: make extraPostVM configurable from module.nix --- lib/make-disk-image.nix | 2 +- module.nix | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/make-disk-image.nix b/lib/make-disk-image.nix index 4c39cbf..e00ec8e 100644 --- a/lib/make-disk-image.nix +++ b/lib/make-disk-image.nix @@ -3,7 +3,7 @@ , pkgs ? nixosConfig.pkgs , lib ? pkgs.lib , name ? "${nixosConfig.config.networking.hostName}-disko-images" -, extraPostVM ? "" +, extraPostVM ? nixosConfig.config.disko.extraPostVM , checked ? false }: let diff --git a/module.nix b/module.nix index be14638..2366809 100644 --- a/module.nix +++ b/module.nix @@ -17,6 +17,17 @@ in ''; default = [ ]; }; + extraPostVM = lib.mkOption { + type = lib.types.str; + description = '' + extra shell code to execute once the disk image(s) have been succesfully created and moved to $out + ''; + default = ""; + example = pkgs.literalExpression '' + ''${pkgs.zstd}/bin/zstd --compress $out/*raw + rm $out/*raw + ''; + }; memSize = lib.mkOption { type = lib.types.int; description = ''