scrush
January 17, 2025, 3:38pm
1
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:
{ config, lib, ... }:
with lib;
let
cfg = config.system.nixos;
in
{
options.system = {
nixos.label = mkOption {
type = types.strMatching "[a-zA-Z0-9:_\\.-]*";
description = ''
NixOS version name to be used in the names of generated
outputs and boot labels.
If you ever wanted to influence the labels in your GRUB menu,
this is the option for you.
This file has been truncated. show original
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
scrush
January 17, 2025, 3:49pm
3
yes, i am using flakes.
oooh dear. that took me hours
thank you! I am setting your reply as solution.