colemickens / nixos-flake-example

This is a demo NixOS config, with optional flakes support. Along with notes on why flakes is useful and worth adopting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use @inputs instead

MatthewCroughan opened this issue · comments

https://github.com/kanashimia/nixos/blob/330206bf1d120174702f6e09423c1c19bc2ae847/flake.nix does this.

Instead of:

outputs = inputs:
/* ignore:: */ let ignoreme = ({config,lib,...}: with lib; { system.nixos.revision = mkForce null; system.nixos.versionSuffix = mkForce "pre-git"; }); in
{

Would it not make more sense to just have this?

outputs = { config,lib, ... }@inputs: {

I do not understand the purpose of leting those values. I know it says ignoreme but I can't! I feel I understand the rest of this example perfectly, but this part doesn't make sense.

At least a comment could be provided to suggest why these values are being let if @input does not suffice.

No.

{a, b, ...}@inputs binds a and b to inputs.a and inputs.b. Unlike other flakes, I don't like this, and I like having to put/see inputs.<input> everywhere they're used.

The "ignoreme" part is entirely 100% unrelated to the function signature, it's just a simple extra variable being defined (ignoreme) that encompasses a nixos module that ensures the flake/non-flake version strings are identical. Lines 11 and 20 could be removed and the example would be practically the same (though without ignoreme) the flake/non-flake would produce different outputs due to different version strings).