voidcontext / nixos-uconsole

Mirror of https://git.vdx.hu/voidcontext/nixos-uconsole
4 stars 1 forks source link

Needs additional Nix features? #1

Open j340m3 opened 1 month ago

j340m3 commented 1 month ago

What i did

  1. Being on Windows, I downloaded virtualbox and the nixos viritualbox image https://nixos.org/download/#nixos-virtualbox
  2. Booting up the image and activating git temporarily via nix-shell -p git
  3. Downloading the repo via git clone https://git.vdx.hu/voidcontext/nixos-uconsole.git
  4. cd nixos-uconsole
  5. Running the command in the README.md: nix build .\#packages.aarch64-linux.\"sd-image-cm4-6.1-potatomania\" -L

Expected Behaviour Nix builds an image that I can put on my sd-card, location `result/sd-image

Actual Result`

[nix-shell:~/git/nixos-uconsole]$ nix build .\#packages.aarch64-linux.\"sd-image-cm4-6.1-potatomania\" -L
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

[nix-shell:~/git/nixos-uconsole]$ nix build .\#packages.aarch64-linux.\"sd-image-cm4-6.1-potatomania\" -L --extra-experimental-features
error: flag '--extra-experimental-features' requires 1 argument(s), but only 0 were given
Try 'nix --help' for more information.

[nix-shell:~/git/nixos-uconsole]$ nix build .\#packages.aarch64-linux.\"sd-image-cm4-6.1-potatomania\" -L --extra-experimental-features nix-command
error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override

[nix-shell:~/git/nixos-uconsole]$ nix build .\#packages.aarch64-linux.\"sd-image-cm4-6.1-potatomania\" -L --extra-experimental-features nix-command --extra-experimental-features flakes
error:
       … while calling the 'import' builtin

         at /nix/store/1r9cs7jyb2jwjs558axv5mh62dx4jd9v-source/flake.nix:22:12:

           21|
           22|     pkgs = import nixpkgs {inherit system overlays;};
             |            ^
           23|

       … in the condition of the assert statement

         at «string»:66:13:

           65|           if node.flake or true then
           66|             assert builtins.isFunction flake.outputs;
             |             ^
           67|             result

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: failed to extract archive (Write failed)

Question What am I doing wrong and could we update the README.md command to make it more clear, what to do? I have some NixOS experience but was shyed away from using flakes. Probably something that I have to look into now.

j340m3 commented 1 month ago

And the cross-platform kernel yielded the same result:

[nix-shell:~/git/nixos-uconsole]$ nix build .\#packages.aarch64-linux.\"sd-image-cm4-6.1-potatomania-cross-build\" -L --extra-experimental-features nix-command --extra-experimental-features flakes
error:
       … while calling the 'import' builtin

         at /nix/store/1r9cs7jyb2jwjs558axv5mh62dx4jd9v-source/flake.nix:22:12:

           21|
           22|     pkgs = import nixpkgs {inherit system overlays;};
             |            ^
           23|

       … in the condition of the assert statement

         at «string»:66:13:

           65|           if node.flake or true then
           66|             assert builtins.isFunction flake.outputs;
             |             ^
           67|             result

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: failed to extract archive (Write failed)
j340m3 commented 1 month ago

nix flake show is also not providing meaningful results:

[nix-shell:~/git/nixos-uconsole]$ nix flake show --experimental-features 'nix-command flakes'
git+file:///home/demo/git/nixos-uconsole?ref=refs/heads/main&rev=51ee23e73e5ee2306a755516a47481f9fa9264f5
error:
       … in the right operand of the update (//) operator

         at /nix/store/1r9cs7jyb2jwjs558axv5mh62dx4jd9v-source/flake.nix:51:7:

           50|       {default = base-module;}
           51|       // (pkgs.lib.attrsets.mapAttrs' (name: value: {
             |       ^
           52|           name = "kernel-${name}";

       … while calling the 'import' builtin

         at /nix/store/1r9cs7jyb2jwjs558axv5mh62dx4jd9v-source/flake.nix:22:12:

           21|
           22|     pkgs = import nixpkgs {inherit system overlays;};
             |            ^
           23|

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: failed to extract archive (Write failed)
voidcontext commented 1 month ago

Hi @j340m3, I am not sure why you're getting that specific error you're getting, but I am almost sure the root of the problem is that the system derivation requires aarch64 architecture, and I am almost sure the VirtualBox VM is x86. Even the cross compiled derivation requires aarch64 because only the kernel package is crosscompiled. So you either need to run nix build on a 64bit arm machine, or you need to configure your x86 machine to delegate aarch64 builds to another machine using nix's remote build feature.