NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.67k stars 13.12k forks source link

Build failure: service.ollama #324960

Closed fiq closed 1 week ago

fiq commented 2 weeks ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. With unstable defined, enable the ollama service with pkg overridden to point at unstable:
  services.ollama.enable = true; 
  services.ollama.acceleration = "cuda";
  services.ollama.package = unstable.ollama;

Build log

without show-trace:

error:
       … while calling the 'head' builtin

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-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/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-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;

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

       error: function 'anonymous lambda' called with unexpected argument 'linuxPackages'

       at /nix/store/dk2rpyb6ndvfbf19bkb2plcz5y3k8i5v-source/pkgs/by-name/ol/ollama/package.nix:1:1:

            1| { lib
             | ^
            2| , buildGo122Module

with --show-trace:

error:
       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1571:24:

         1570|     let f = attrPath:
         1571|       zipAttrsWith (n: values:
             |                        ^
         1572|         let here = attrPath ++ [n]; in

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.build.toplevel':

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/system/activation/top-level.nix':

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/system/activation/top-level.nix:71:12:

           70|   # Replace runtime dependencies
           71|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
           72|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while calling 'foldr'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:121:20:

          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:128:8:

          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:124:15:

          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/system/activation/top-level.nix:68:10:

           67|     then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
           68|     else showWarnings config.warnings baseSystem;
             |          ^
           69|

       … while calling 'showWarnings'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/trivial.nix:867:28:

          866|
          867|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                            ^
          868|

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/trivial.nix:867:33:

          866|
          867|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                                 ^
          868|

       … while calling 'foldr'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:121:20:

          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:128:8:

          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:124:15:

          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `warnings':

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/system/boot/systemd.nix':

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1096:10:

         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
         1097|

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1096:16:

         1095|     attrs:
         1096|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
         1097|

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/system/boot/systemd.nix:443:16:

          442|       mapAttrsToList
          443|         (name: service:
             |                ^
          444|           let

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/system/boot/systemd.nix:450:16:

          449|             concatLists [
          450|               (optional (type == "oneshot" && (restart == "always" || restart == "on-success"))
             |                ^
          451|                 "Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'"

       … while calling 'optional'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/lists.nix:784:20:

          783|   */
          784|   optional = cond: elem: if cond then [elem] else [];
             |                    ^
          785|

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `systemd.services.ollama.serviceConfig':

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:846:59:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/types.nix:583:20:

          582|       check = isAttrs;
          583|       merge = loc: defs:
             |                    ^
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/types.nix:584:35:

          583|       merge = loc: defs:
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          585|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:646:5:

          645|     pred:
          646|     set:
             |     ^
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:647:29:

          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          648|

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:647:62:

          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          648|

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/types.nix:584:51:

          583|       merge = loc: defs:
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          585|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/types.nix:584:86:

          583|       merge = loc: defs:
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          585|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/services/misc/ollama.nix':

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/nixos/modules/services/misc/ollama.nix:120:24:

          119|       serviceConfig = {
          120|         ExecStart = "${lib.getExe ollamaPackage} serve";
             |                        ^
          121|         WorkingDirectory = cfg.home;

       … while calling 'getExe'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/meta.nix:165:12:

          164|   */
          165|   getExe = x: getExe' x (x.meta.mainProgram or (
             |            ^
          166|     # This could be turned into an error when 23.05 is at end of life

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/meta.nix:165:15:

          164|   */
          165|   getExe = x: getExe' x (x.meta.mainProgram or (
             |               ^
          166|     # This could be turned into an error when 23.05 is at end of life

       … while calling 'getExe''

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/meta.nix:181:16:

          180|   */
          181|   getExe' = x: y:
             |                ^
          182|     assert assertMsg (isDerivation x)

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/meta.nix:182:12:

          181|   getExe' = x: y:
          182|     assert assertMsg (isDerivation x)
             |            ^
          183|       "lib.meta.getExe': The first argument is of type ${typeOf x}, but it should be a derivation instead.";

       … while calling 'assertMsg'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/asserts.nix:41:5:

           40|     pred:
           41|     msg:
             |     ^
           42|     pred || builtins.throw msg;

       … from call site

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/meta.nix:182:23:

          181|   getExe' = x: y:
          182|     assert assertMsg (isDerivation x)
             |                       ^
          183|       "lib.meta.getExe': The first argument is of type ${typeOf x}, but it should be a derivation instead.";

       … while calling 'isDerivation'

         at /nix/store/gwdrgcmnnxji8laxiv7zyhi8s1iijcgw-source/lib/attrsets.nix:1283:5:

         1282|   isDerivation =
         1283|     value: value.type or null == "derivation";
             |     ^
         1284|

       … from call site

         at /nix/store/dk2rpyb6ndvfbf19bkb2plcz5y3k8i5v-source/lib/trivial.nix:955:7:

          954|     { # TODO: Should we add call-time "type" checking like built in?
          955|       __functor = self: f;
             |       ^
          956|       __functionArgs = args;

       … while calling anonymous lambda

         at /nix/store/dk2rpyb6ndvfbf19bkb2plcz5y3k8i5v-source/lib/customisation.nix:144:34:

          143|       # Re-call the function but with different arguments
          144|       overrideArgs = mirrorArgs (newArgs: makeOverridable f (overrideWith newArgs));
             |                                  ^
          145|       # Change the result of the function call by applying g to it

       … from call site

         at /nix/store/dk2rpyb6ndvfbf19bkb2plcz5y3k8i5v-source/lib/trivial.nix:955:7:

          954|     { # TODO: Should we add call-time "type" checking like built in?
          955|       __functor = self: f;
             |       ^
          956|       __functionArgs = args;

       … while calling anonymous lambda

         at /nix/store/dk2rpyb6ndvfbf19bkb2plcz5y3k8i5v-source/lib/customisation.nix:136:17:

          135|     in
          136|     mirrorArgs (origArgs:
             |                 ^
          137|     let

       error: function 'anonymous lambda' called with unexpected argument 'linuxPackages'

       at /nix/store/dk2rpyb6ndvfbf19bkb2plcz5y3k8i5v-source/pkgs/by-name/ol/ollama/package.nix:1:1:

            1| { lib
             | ^
            2| , buildGo122Module

Additional context

Add any other context about the problem here.

Notify maintainers

@SomeoneSerge @yshui

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.32, NixOS, 24.05 (Uakari), 24.05.20240531.805a384`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(raf): `""`
 - channels(root): `"home-manager-24.05.tar.gz, nixos-24.05, unstable"`
 - nixpkgs: `/nix/store/i1aw9jjgxcvyd642s12kw3iasmarwd42-source`

Add a :+1: reaction to issues you find important.

SomeoneSerge commented 2 weeks ago

Hi! Can you confirm your nixpkgs revision has this change incorporated and you're not overriding the package manually? https://github.com/NixOS/nixpkgs/pull/323249/files#diff-2d862bf9684df6fdface7aabf2af2b1767eb17ba2f9ab8b2e7db03d22c3c0660L6-L10