about summary refs log tree commit diff
path: root/nixos/modules/image
diff options
context:
space:
mode:
authorVincent Haupert <vincent@yaxi.tech>2023-08-04 13:32:45 +0200
committerVincent Haupert <vincent@yaxi.tech>2023-08-04 13:49:18 +0200
commitf652755434cf9a948c2e81c785af663362a0b06f (patch)
tree8d21765d6337c03925f447d25d5e85b703bbc081 /nixos/modules/image
parentbf4d2e6c1ecdf5e46271bcb5f90541539e06446b (diff)
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.
Diffstat (limited to 'nixos/modules/image')
-rw-r--r--nixos/modules/image/repart.nix13
1 files changed, 10 insertions, 3 deletions
diff --git a/nixos/modules/image/repart.nix b/nixos/modules/image/repart.nix
index 4362982f5bac7..4a0021e9a56e5 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})