I am setting up a new (old) laptop with disko, but I am falling over an error which I am struggling to understand.
This is the disko-config.nix:
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
priority = 1;
name = "ESP";
start = "1M";
end = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0777" ];
};
};
root = {
size = "100%";
content = {
type = "btrfs";
extraArgs = [ "-f" ]; # Override existing artition
# Subvolumes must set a mountpoint in order to be
# mounted, unless their parent is mounted
subvolumes = {
# Subvolume name is sifferent from mountpoint
"/rootfs" = {
mountpoint = "/";
};
"/home" = {
mountpoint = "/home";
};
"/home/paul" = {};
"/nix" = {
mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix";
};
"/swap" = {
mountpoint = "/.swapvol";
swap = {
swapfile.size = "20G";
swapfile2.size = "20G";
swapfile2.path = "rel-path";
};
};
};
mountpoint = "/partition-root";
swap = {
swapfile = {
size = "20G";
};
swapfile1 = {
size = "20G";
};
};
};
};
};
};
};
};
};
}
As you can see, this is pretty much in line with the example from the disko repository. I used this to do the initial partitioning and formatting, then did the NixOS install on top. My next step was to take my oldish flake configuration, and set up for the new laptop. I included disko in the inputs, and pulled the disko-config.nix into my hardware-configuration.nix flake for the laptop. I now get an error when doing the sudo nixos-rebuild switch --flake .:
building the system configuration...
error:
… while calling the 'head' builtin
at /nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating definitions from `/nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/nixos/modules/system/activation/top-level.nix':
… while evaluating the option `assertions':
… while evaluating definitions from `/nix/store/j8khkd22lpxy5b5scyhx87yyzcvzhzcz-source/nixos/common.nix':
… while evaluating the option `home-manager.users.paul.assertions':
… while evaluating definitions from `/nix/store/j8khkd22lpxy5b5scyhx87yyzcvzhzcz-source/modules/systemd.nix':
… while evaluating the option `home-manager.users.paul.home.username':
… while evaluating definitions from `/nix/store/j8khkd22lpxy5b5scyhx87yyzcvzhzcz-source/nixos/common.nix':
… while evaluating the option `users.users':
… while evaluating definitions from `/nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/nixos/modules/services/networking/rpcbind.nix':
… while evaluating the option `services.rpcbind.enable':
… while evaluating definitions from `/nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/nixos/modules/tasks/filesystems/nfs.nix':
… while evaluating the option `boot.supportedFilesystems':
… while evaluating definitions from `/nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/nixos/modules/tasks/filesystems.nix':
… while evaluating the option `fileSystems."/".device':
… while evaluating definitions from `/nix/store/4xd5v91hsmakfq53qbbdph5fis62zbnp-source/module.nix':
… while evaluating the option `disko.devices.disk.main.content.partitions.root.content.device':
… while evaluating the module argument `device' in "/nix/store/4xd5v91hsmakfq53qbbdph5fis62zbnp-source/lib/types/btrfs.nix":
… while evaluating definitions from `':
… while evaluating the option `disko.devices.disk.main.content.partitions.root.device':
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: attribute 'match' missing
at /nix/store/4xd5v91hsmakfq53qbbdph5fis62zbnp-source/lib/default.nix:267:15:
266| lib.stringAsChars (
267| c: if lib.match allowedChars c != null || c == "" then c else "\\x" + charToHex c
| ^
268| );
Did you mean path?
If I understand the error correctly, it is looking for disko.devices.disk.main.content.partitions.root.device, but this option isn’t present in my configuration?
I know there are other errors in my configuration, and I am clearing them as they arise, but this one is defeating me at the moment!
If anyone can point me in the right direction, I would be very appreciative!
Thanks in advance, and apologies for the long post.