snowfallorg / lib

Unified configuration for systems, packages, modules, shells, templates, and more with Nix Flakes.
https://snowfall.org
Other
428 stars 38 forks source link

Is it possible to access home config, from nixos config? #137

Open Straffern opened 3 weeks ago

Straffern commented 3 weeks ago

I need to set an environment variable depending on if a home manager module is enabled. Specifically I want something like this:

environment.sessionVariables.NIXOS_OZONE_WL = mkIf snowfallorg.users.${
        config.${namespace}.user.name
      }.home.config.desktop.hyprland.enable
      "1"; # Hint electron apps to use wayland

Where desktop.hyprland is a module living in: modules/home/desktop/hyprland/default.nix

bestlem commented 2 weeks ago

Why do you need its as a global variable for all users rather than setting it in home-manager using home.sessionVariables ?

Straffern commented 2 weeks ago

@bestlem NIXOS_OZONE_WL has to be a global variable. Hyprland does not load user vars.

Nikola-Milovic commented 1 week ago

Can you reverse it? You set hyprland on the nixos system level (you can have just empty option) and then check for that in the home modules with osConfig? I had a few of these cases myself