Ninlives / minecraft.nix

Command line Minecraft launcher managed by nix
44 stars 8 forks source link

Running into error "error: value is a function while a list was expected" when trying to use the flake #1

Closed tcheneau closed 2 years ago

tcheneau commented 2 years ago

Hello,

First off, thank you for this flake.

I'm new to flakes, so this might be a beginner's mistake on my side.

I am running on the following error when I try to use this flake in NixOS 21.11:

error: value is a function while a list was expected

       at /nix/store/cijly7m9alsipw3x5097hnz2ayw4lw3x-source/builder.nix:127:19:

          126|       final = evalModules {
          127|         modules = modules
             |                   ^
          128|           ++ [ ({ _module.args.pkgs = pkgs; }) (import ./module) ];
(use '--show-trace' to show detailed location information)

I invoke the flake with the following command:

NIXPKGS_ALLOW_UNFREE=1 nixFlakes run   --impure ".#v1_18_1.vanilla.client"

(The nixFlakes command comes from https://nixos.wiki/wiki/Flakes#Installation_as_an_extra_command)

I tried to modify line 127 of builder.nix so that modules becomes a list with the following "patch":

diff --git a/builder.nix b/builder.nix
index 930c86a..9ccb86e 100644
--- a/builder.nix
+++ b/builder.nix
@@ -124,7 +124,7 @@ let
   mkLauncher = modules:
     let
       final = evalModules {
-        modules = modules
+        modules = [ modules ]
           ++ [ ({ _module.args.pkgs = pkgs; }) (import ./module) ];
       };
     in final.config.launcher // {

I now run into the following error:

error: value is a list while a set was expected

       at /nix/store/0gcda509wdm9zchk4m0dn433aixi5300-source/lib/modules.nix:366:44:

          365|         options = {};
          366|         config = addFreeformType (addMeta (removeAttrs m ["_file" "key" "disabledModules" "require" "imports" "freeformType"]));
             |                         

I tried an earlier version of the repository (commit 3674454b847a2bcef7d20274003b5b1c7dfa0219) and managed to run the flake correctly (it runs the script that asks for a MSA logon).

Do you have any ideas of what I'm doing wrong?

Best regards, Tony

Ninlives commented 2 years ago

Hi, thanks for your feedback, I totally forgot to test the vanilla client, my bad :sweat_smile: This should have been fixed in the latest commit, please test and tell me if it works correctly!

tcheneau commented 2 years ago

Thank you @Ninlives, that one-line change did the trick. :-)

I was very far from finding the issue myself, I'll work on my Nix-fu.

Regards, Tony