NIXOS_LABEL_VERSION is ignored

I am trying to modify my grub menulist to include some more information via the NIXOS_LABEL_VERSION variable of nixos-rebuild’s environment.

But that seems to get blatantly ignored.
My approach is based on:

That said, my testscript is just:

        #!/bin/sh
        today=`date +%Y%m%d`
        export NIXOS_LABEL_VERSION="$today"
        nixos-rebuild boot

does that work for you? Are we facing a bug? I am happy to open an issue on github, but I might need some help figuring out, where that would be placed to.
My grub menu list looks just as I would’ve not set NIXOS_LABEL_VERSION at all.

Using flakes? envvars are ignored in pure eval.

Also if you’re using sudo, see Passing Environment Variable to nixos-rebuild - #4 by waffle8946

1 Like

yes, i am using flakes.
oooh dear. that took me hours :frowning:

thank you! I am setting your reply as solution.