snowfallorg / lib

Unified configuration for systems, packages, modules, shells, templates, and more with Nix Flakes.

Home Page:https://snowfall.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help request: `error: attempt to call something which is not a function but a set`

aidenscott2016 opened this issue · comments

Hello,

I am trying to port my config to use snowfall. I've restructured my directories to suit the pattern laid out in the documentation. When attempting to build my system I get the following error:

$ nixos-rebuild dry-build --flake .#locutus --show-trace

[truncated]

       at /nix/store/s02jdlqmv902b0y19jy4kybl86ylwvvy-source/lib/modules.nix:519:8:

          518|       # works.
          519|     in f (args // extraArgs);
             |        ^
          520|

       … while calling 'transmission'

       at /nix/store/dkp41micvz3v8ba4rlmln6dvbh0yiv5a-j9c415rh87wp12q9a9g2xc7kjqnyg147-source/snowfall-lib/module/default.nix:48:32:

           47|             # pass values in. For this reason we must specify things like `pkgs` as a named attribute.
           48|             ${metadata.name} = args@{ pkgs, ... }:
             |                                ^
           49|               let

       error: attempt to call something which is not a function but a set

       at /nix/store/dkp41micvz3v8ba4rlmln6dvbh0yiv5a-j9c415rh87wp12q9a9g2xc7kjqnyg147-source/snowfall-lib/module/default.nix:76:31:

           75|                 };
           76|                 user-module = import metadata.path modified-args;
             |                               ^
           77|               in


Transmission is the last module alphabetically. If I delete this module, then the error will state steam instead. I don't think there are any issues in any of the modules

For reference, here is my snowfall branch: https://github.com/aidenscott2016/nixos/tree/refactor

Thanks!

I've seen that this issue mentions that the modules API isn't documented correctly, but don't think it applies in this case. I thought that all inputs and self modules (./modules/nixos) would be passed to my host's module ./system/x86..../locutus.nix

Deleting all modules from ./modules will allow the build to continue

I should also be using up to date inputs. The problem persists after nix flake update

Never mind, the issue was in one of my modules, but I was mislead by the error message. As suspected the problematic module was not transmission but gc which, just like the error said, was a simple set, not a function.

diff --git a/modules/nixos/gc/default.nix b/modules/nixos/gc/default.nix
index 63600b2..0126798 100644
--- a/modules/nixos/gc/default.nix
+++ b/modules/nixos/gc/default.nix
@@ -1,4 +1,4 @@
-{
+inputs: {
   nix.gc = {
     automatic = true;
     dates = "weekly";