Commit dff30f9b authored by Arian van Putten's avatar Arian van Putten
Browse files

nixos/image/repart-verity-store: rename system.build.finalImage to system.build.image

parent a75b9ddf
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -112,10 +112,11 @@ in
    };

    system.build = {
      finalImage = lib.warn "system.build.finalImage has been renamed to system.build.image" config.system.build.image;

      # intermediate system image without ESP
      intermediateImage =
        (config.system.build.image.override {
        (config.image.repart.image.override {
          # always disable compression for the intermediate image
          compression.enable = false;
        }).overrideAttrs
@@ -162,8 +163,8 @@ in
        );

      # final system image that is created from the intermediate image by injecting the UKI from above
      finalImage =
        (config.system.build.image.override {
      image = lib.mkOverride 99 (
        (config.image.repart.image.override {
          # continue building with existing intermediate image
          createEmpty = false;
        }).overrideAttrs
@@ -216,6 +217,7 @@ in
                rm -v repart-output_orig.json
              '';
            }
          )
      );
    };
  };
+41 −30
Original line number Diff line number Diff line
@@ -282,6 +282,15 @@ in
      '';
    };

    image = lib.mkOption {
      type = lib.types.package;
      internal = true;
      readOnly = true;
      description = ''
        The image built by this module. Used as the default for `system.build.image`.
      '';
    };

    assertions = lib.mkOption {
      type = options.assertions.type;
      default = [ ];
@@ -356,6 +365,37 @@ in

        finalPartitions = lib.mapAttrs addClosure cfg.partitions;

        image =
          let
            fileSystems = lib.filter (f: f != null) (
              lib.mapAttrsToList (_n: v: v.repartConfig.Format or null) cfg.partitions
            );

            format = pkgs.formats.ini { listsAsDuplicateKeys = true; };

            definitionsDirectory = utils.systemdUtils.lib.definitions "repart.d" format (
              lib.mapAttrs (_n: v: { Partition = v.repartConfig; }) cfg.finalPartitions
            );

            mkfsEnv = mkfsOptionsToEnv cfg.mkfsOptions;
            val = pkgs.callPackage ./repart-image.nix {
              systemd = cfg.package;
              inherit (config.image) baseName;
              inherit (cfg)
                name
                version
                compression
                split
                seed
                imageSize
                sectorSize
                finalPartitions
                ;
              inherit fileSystems definitionsDirectory mkfsEnv;
            };
          in
          lib.asserts.checkAssertWarn cfg.assertions cfg.warnings val;

        assertions = lib.mapAttrsToList (
          fileName: partitionConfig:
          let
@@ -401,36 +441,7 @@ in
        );
      };

    system.build.image =
      let
        fileSystems = lib.filter (f: f != null) (
          lib.mapAttrsToList (_n: v: v.repartConfig.Format or null) cfg.partitions
        );

        format = pkgs.formats.ini { listsAsDuplicateKeys = true; };

        definitionsDirectory = utils.systemdUtils.lib.definitions "repart.d" format (
          lib.mapAttrs (_n: v: { Partition = v.repartConfig; }) cfg.finalPartitions
        );

        mkfsEnv = mkfsOptionsToEnv cfg.mkfsOptions;
        val = pkgs.callPackage ./repart-image.nix {
          systemd = cfg.package;
          inherit (config.image) baseName;
          inherit (cfg)
            name
            version
            compression
            split
            seed
            imageSize
            sectorSize
            finalPartitions
            ;
          inherit fileSystems definitionsDirectory mkfsEnv;
        };
      in
      lib.asserts.checkAssertWarn cfg.assertions cfg.warnings val;
    system.build.image = cfg.image;
  };

  meta.maintainers = with lib.maintainers; [
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@
        "-f",
        "qcow2",
        "-b",
        "${nodes.machine.system.build.finalImage}/${nodes.machine.image.filePath}",
        "${nodes.machine.system.build.image}/${nodes.machine.image.filePath}",
        "-F",
        "raw",
        tmp_disk_image.name,