Urgent.News

What's breaking now, across hundreds of outlets.

Tech

`specialArgs` considered harmful

This article discusses the issue of using specialArgs in NixOS/nix-darwin/home-manager, which can lead to unshareable modules and make it hard to copy-paste configurations. The author explains that specialArgs are often used in inputs to pass around styling dependencies across various components in NixOS. However, as configurations grow larger, specialArgs can become unshareable and lead to hard-to-debug errors.

The author suggests that the issue stems from how modules are evaluated with lib.evalModules and how specialArgs are injected into the arguments passed to the modules. They explain that a module can either have 0 or 1 argument, and that when a module asks for inputs in its arguments, it will only work if the user puts the inputs in the specialArgs or config._module.args.

To address this issue, the author proposes moving curried modules to a separate file and calling import ./version.nix { inherit inputs; }. This approach uses importApplyWithArgs to scan every file under a module directory, applying user-passed arguments and wrapping the result to ensure error messages point to the correct location. By using this method, external consumers of the modules are not forced to provide arguments they don't define, and the structural scoping provided by the module system is maintained.

The author also mentions that the module system keeps the first module with a given key and never reads the rest, which can lead to silent drops of modules when applied with different arguments. They recommend using _module.args instead of specialArgs, but note that this may cause issues in certain cases, such as infinite recursion when pulling a module out of inputs with it.

Rewritten by urgent.news; may contain errors — check the original.

Source: ysun.co

Read the original at ysun.co →

Report a problem with this story

More in Tech

How to Monitor Your Competitors' Ads Automatically (Google, LinkedIn and Bing) with Apify

When a competitor launches a new offer, you usually see it in their ads first: a new headline, a new landing page, a new video, a webinar promo.

  • Apify actors monitor Google, LinkedIn, and Bing ad libraries for new competitor ads.
  • Actors use Digital Services Act libraries for transparent competitor data in EU.
  • Set up daily job to deliver new ads to Slack, email, or webhook for analysis.

S. Korea warns of AI-aided hacking after bank data breaches

Seoul is alarmed after a recent breach of South Korean banks' cyber defenses that reportedly involved AI-assisted hacking.

  • South Korea demands overhaul of cyber safeguards after seven financial breaches.
  • Potential AI involvement in phishing attacks raises security concerns.
  • 68,000 customers' data compromised, including personal details and loan info.

More from Thursday 8 October →