Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: attribute 'disko' missing #765

Open
StijnRuts opened this issue Sep 10, 2024 · 12 comments
Open

error: attribute 'disko' missing #765

StijnRuts opened this issue Sep 10, 2024 · 12 comments
Labels
question Not a bug or issue, but a question asking for help or information

Comments

@StijnRuts
Copy link

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 = {
@StijnRuts
Copy link
Author

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)

@StijnRuts
Copy link
Author

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.

@iFreilicht
Copy link
Contributor

Could you post the entirety of your /root/disko-config.nix?

@iFreilicht iFreilicht added the question Not a bug or issue, but a question asking for help or information label Oct 1, 2024
@vennsofar
Copy link

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.

@StijnRuts
Copy link
Author

StijnRuts commented Oct 8, 2024

@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.

@vennsofar
Copy link

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.

@StijnRuts
Copy link
Author

@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.

@iFreilicht
Copy link
Contributor

@vennsofar Your top-level attribute is disk, but it should be disko.devices.disk

@vennsofar
Copy link

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.

@iFreilicht
Copy link
Contributor

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?

@iFreilicht
Copy link
Contributor

To get back to the original issue:

When I change config.disko.devices to disko.devices it does work.

Where did you use config.disko.devices anyway? I'm wondering whether disko maybe isn't evaluating modules correctly in some cases.

@vennsofar
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Not a bug or issue, but a question asking for help or information
Projects
None yet
Development

No branches or pull requests

3 participants