Error: Called without required argument which is provided?

Referencing: Rework deployment mechanism for installations by Kreyren · Pull Request #78 · NiXium-org/NiXium · GitHub

Thanks for any relevant info! <3

       error: function 'anonymous lambda' called without required argument 'inputs'

       at /nix/store/r46j50bb1kjlay2cgdvg278hpxvh9xg5-source/tasks/administration/install/script.nix:1:1:

            1| { pkgs, inputs, ... }:

I think this means that the record that is passed as an argument to this function does not contain an inputs key. What are you trying to do?

Since script.nix is an independent nix file and not loaded as a NixOS module here: Rework deployment mechanism for installations by Kreyren · Pull Request #78 · NiXium-org/NiXium · GitHub

You need to explicitly pass all function arguments

Currently, you’re only passing pkgs:

import ./script.nix { inherit pkgs; }

inherit just assigns a variable to an attribute with the same name as the variable. You’ll need to pass inputs into your module, and then also set that in the attribute set:

import ./script.nix { inherit pkgs inputs; }

That is, assuming you actually want to import that file. You may be better off writing that script in a proper .sh and builtins.readFile-ing it in an in-line buildShellApplication or such. Or using the (presumably) module system and the config arg - odd to see a static string set in what looks like a module option just so it can be imported.

This points to some fundamemtal misunderstanding around import and function calls. Maybe give the language tutorial another read, especially this section: Nix language basics — nix.dev documentation

To provide context:

The infrastructure is using disko to perform installations and updates where i can’t just deploy it with disko-install due to How to use `(r)agenix` when first partitioning disk with `disko`? · Issue #657 · nix-community/disko · GitHub as it currently needs to parse the disk encryption secret and host key bcs ragenix + inpermanence.

To do that i’ve made a quick scripts for systems such as:

Which relies on the devshell to provide the dependencies for the script to work (logic-wise it has issues that i am trying to fix now)

To provide interface for the infra it’s using mission control (so that i can just do , command to interface with it) the problem there is that the wrapper doesn’t implement the inputs for writeShellApplication in mission-control/nix/wrapper.nix at db5e2cc39c6799b301412d69182b9221c65146a8 · Platonic-Systems/mission-control · GitHub

So i am trying to implement it in this hacky-way just so that i can experiment with it to figure out where to go from there for implementation that is mergable as i am unsure if i want to parse these tasks as nix file so that i have the added functionality on top of shell or just using pure shell or something else as it’s projected to have a quite complex operations such as refreshing secret files and having custom courses of actions in case the device is stolen (flaging it as stolen, making the device seem like it’s generic unlocked windows and contacting authorities with precise GPS tracking so that it can be retrieved) etc… for which something like python might be a better solution… maybe programming language flexible implementation that can be declared as a nix module?


Afaik the inputs (should be using inputs', but i am trying to simplify the issue) are handled with the perSystem which comes from flake-parts

as Inheriting inputs causes error: attribute 'install-task' missing as afaik that will be trying to overwrite a an unmuttable variable causing the module to fail evaluation.

See Rework deployment mechanism for installations by Kreyren · Pull Request #78 · NiXium-org/NiXium · GitHub

After brainstorm with flake-parts upstream figured out the implementation as Rework deployment mechanism for installations by Kreyren · Pull Request #78 · NiXium-org/NiXium · GitHub

Thanks all for all relevant info! <3

1 Like