disko
disko copied to clipboard
error: attribute 'disko' missing
I am trying to use disko from the installation environment, but I get this error:
[root@nixos:~]# nix --experimental-features "nix-command flakes" flake init --template github:nix-community/disko-templates#single-disk-ext4
wrote: /root/disko-config.nix
[root@nixos:~]# vim disko-config.nix
( added device = "/dev/sda"; )
[root@nixos:~]# nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./disko-config.nix
error:
… while evaluating the attribute 'value'
at /nix/store/p2zlnhfbwx66hmp4l8m3qyyj3yrfr9zh-9qq0zf30wi74pz66rr05zmxq0nv17q1p-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/p2zlnhfbwx66hmp4l8m3qyyj3yrfr9zh-9qq0zf30wi74pz66rr05zmxq0nv17q1p-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: attribute 'disko' missing
at /nix/store/i88xqmnhi9rwanwymlma7p6drql2qc5j-disko/share/disko/default.nix:10:49:
9| # _file = toString input;
10| imports = lib.singleton { disko.devices = cfg.disko.devices; };
| ^
11| options = {
When I change config.disko.devices to disko.devices it does work.
(Tough I do still get an error about "wrong fs type" on mount)
Tough I do still get an error about "wrong fs type" on mount
When I look at my disk in gparted, the root partition is listed as type swap instead of ext4.
Could you post the entirety of your /root/disko-config.nix?
I'm also having this issue, I haven't been able to fix it with any workarounds though. AFAIK I followed the template pretty closely, only changed things specific to my setup. Can send my disko-config.nix if needed.
@vennsofar I ended up with this configuration: https://github.com/StijnRuts/NixOS-config/blob/c5369206161d2b3352a3dbaa8417f6f030ba18e3/disko/T420.nix
Can send my disko-config.nix if needed.
I can take a look. No promise that I'll find the issue tough.
https://github.com/user-attachments/files/17297572/disko-config.txt Here's mine. What I was intending was to have a 1.5Gb Efi, 30Gb swap, and have the rest of the drive be ZFS split up into a similar setup as found on the NixOS wiki page.
Thanks in advance if you do end up taking a look at it.
@vennsofar Your config looks fine, as far as I can tell.
The only thing I am unsure of is size = "1.5G";. I don't know if decimals are accepted. Maybe try size = "1500M";.
I had issues with zfs, which is why I switched to btrfs.
@vennsofar Your top-level attribute is disk, but it should be disko.devices.disk
Looks like including both fixes got past the the Nix errors, but the program still isn't finishing correctly, only the first partition is being created, but not being formatted. None of the other partitions (Swap & ZPool) are being created nor formatted. Not sure where the problem is, though I'm assuming I missed something, going to take another look at the documentation. I can either post the error here or make another issue, not sure if it's related or not.
I'd say create a new issue because it's about a different kind of error. But yes, let's take a look at the logs together.
Just for clarification, which two fixes do you mean?
To get back to the original issue:
When I change
config.disko.devicestodisko.devicesit does work.
Where did you use config.disko.devices anyway? I'm wondering whether disko maybe isn't evaluating modules correctly in some cases.
I used both your suggestion and @StijnRuts suggestion, as I wasnt sure if the decimal was causing any issues or not.
As for your fix, I just added config.disko to the disk top level attribute like this
{
disko.devices.disk = {
main = {
type = "disk";
...
(where disko.devices.disk was originally just disk)
I'll make a new Issue for the other errors when I get a chance