nix-community / disko

Declarative disk partitioning and formatting using nix [maintainers=@Lassulus @Enzime @iFreilicht]
MIT License
1.89k stars 201 forks source link

create / mount alternatives #899

Open ARizzo35 opened 3 days ago

ARizzo35 commented 3 days ago

I am creating an install script which goes into an installer image (using nixosGenerate) using the following:

  mkInstallScript = sys: layout:
    sys.pkgs.writeShellApplication {
      name = "install-image";
      text =
        let
          cfg.disko.devices = layout;
          create = sys.pkgs.writeScriptBin "disko-create" (disko.lib.create cfg);
          mount = sys.pkgs.writeScriptBin "disko-mount" (disko.lib.mount cfg);
        in
        ''
          ${create}/bin/disko-create
          ${mount}/bin/disko-mount
          nixos-install --system ${sys.config.system.build.toplevel}
        '';
    };

I noticed the deprecation warnings for disko.lib.create and disko.lib.mount after updating my disko flake input. How should this be handled instead?

iFreilicht commented 3 days ago

Instead of creating the shell scripts yourself, you should use ${sys.config.system.build.format}/bin/disko-format (and analogous for mount) directly.