Override environment.variables with user variable in GNOME?


I use GNOME on NixOS, and I noticed that environment variables, like EDITOR, set by the NixOS option environment.variables are present in my session’s environment. Is there a way to override these variables via user configuration?

I have tried these things:

  • systemd environment.d in ~/.config/environment.d/
  • ~/.profile

This issue seems relevant and has some workarounds, but I’m wondering if there is an official way.

Ryan Mulligan

Maybe not the answer you are looking for; but I’ve solved this with home-manager + NixOS combined.

I tend to make a users/ directory in my NixOS repository and it looks very similar to a home-manager repository.

{ config, pkgs, lib, ... }: {
  imports = [


@fzakaria I don’t understand what your suggestion is.