From f652755434cf9a948c2e81c785af663362a0b06f Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Fri, 4 Aug 2023 13:32:45 +0200 Subject: [PATCH] nixos/image: add `image.repart.package` option Allow giving a custom package containing the `systemd-repart` binary. Defaults to `pkgs.systemd`. This option opens up the possibility to use a different package for the image builder and the system configuration. For example, someone could use this option to build an image with a patched systemd while still using the upstream nixpkgs systemd package (i.e., `pkgs.systemd`) for the system configuration installed to the created image. --- nixos/modules/image/repart.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/nixos/modules/image/repart.nix b/nixos/modules/image/repart.nix index 4362982f5bac..4a0021e9a56e 100644 --- a/nixos/modules/image/repart.nix +++ b/nixos/modules/image/repart.nix @@ -88,6 +88,13 @@ in ''; }; + package = lib.mkPackageOption pkgs "systemd-repart" { + default = "systemd"; + example = lib.literalExpression '' + pkgs.systemdMinimal.override { withCryptsetup = true; } + ''; + }; + partitions = lib.mkOption { type = with lib.types; attrsOf (submodule partitionOptions); default = { }; @@ -178,9 +185,9 @@ in in pkgs.runCommand cfg.name { - nativeBuildInputs = with pkgs; [ - fakeroot - systemd + nativeBuildInputs = [ + cfg.package + pkgs.fakeroot ] ++ fileSystemTools; } '' amendedRepartDefinitions=$(${amendRepartDefinitions} ${partitions} ${definitionsDirectory})