How can I augment a default value instead of overriding it?

Not sure if there is a built in way to merge with the default, but this seems to work for me.

{ modulesPath, options, ... }:

{
  imports = [
    "${modulesPath}/virtualisation/qemu-vm.nix"
  ];

  programs.bash.promptInit = options.programs.bash.promptInit.default + ''
    echo "Extra stuff here"
  '';
}
6 Likes