Disko: Difference between revisions

imported>Onny
mNo edit summary
imported>Onny
Add configuration section
Line 67: Line 67:
# mount | grep /mnt
# mount | grep /mnt
</syntaxhighlight>
</syntaxhighlight>
== Configuration ==
In case the NixOS base system was installed on a partition layout bootstrapped with Disko, the disk config itself can be integrated into the system. First copy the the file, for example <code>disko-config.nix</code> into your system configuration directory
<syntaxhighlight lang="console">
# cp disko-config.nix /etc/nixos/
</syntaxhighlight>
Enable the Disko module on a flake-enabled system. Add the required input and reference it and your <code>disko-config.nix</code> in the modules section. For alternative installation methods consult the Disko [https://github.com/nix-community/disko/blob/master/docs/quickstart.md quickstart guide].
{{file|/etc/nixos/flake.nix|nix|<nowiki>
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
    disko.url = "github:nix-community/disko";
    disko.inputs.nixpkgs.follows = "nixpkgs";
  };
  outputs = {self, nixpkgs, disko, ...}@inputs: {
    nixosConfigurations.mysystem = inputs.nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs.inputs = inputs;
      modules = [
        disko.nixosModules.disko
        ./disko-config.nix
        {
          _module.args.disks = [ "/dev/vda" ];
        }
        ./configuration.nix
      ];
    };
  };
}
</nowiki>}}
Ensure that there are no automatically generated entries of <code>fileSystems</code> options in <code>/etc/nixos/hardware-configuration.nix</code>. Disko will automatically generate them for you. Rebuild your system to apply the Disko configuration.


[[Category:Filesystem]]
[[Category:Filesystem]]