diff --git a/modules/core/nix.nix b/modules/core/nix.nix index 693a960..23d12bc 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -41,9 +41,5 @@ in { }; }; - hjem.users.${username} = { - files.".config/environment.d/${config.local.homeVars.userEnvFile}.conf".text = '' - FLAKE="${config.hjem.users.${username}.directory}/.dotfiles" - ''; - }; + hjem.users.${username}.environment.variables.FLAKE = "${config.hjem.users.${username}.directory}/.dotfiles"; } diff --git a/modules/core/users.nix b/modules/core/users.nix index e0ccf0e..ad85f1d 100644 --- a/modules/core/users.nix +++ b/modules/core/users.nix @@ -3,6 +3,7 @@ config, ... }: let + inherit (lib.filesystem) listFilesRecursive; inherit (config.local.systemVars) username; in { config = lib.mkIf (!config.local.profiles.server.enable) { @@ -24,7 +25,9 @@ in { enable = true; directory = "/home/${username}"; user = "${username}"; + environment.enable = true; }; + extraModules = listFilesRecursive ../../shared/modules/hjem; }; }; } diff --git a/modules/options/homeVars.nix b/modules/options/homeVars.nix index 50295ea..23e16f6 100644 --- a/modules/options/homeVars.nix +++ b/modules/options/homeVars.nix @@ -22,13 +22,6 @@ in { type = str; description = "your ssh public key (used for signing git commits)"; }; - - userEnvFile = mkOption { - type = str; - description = "filename where the user environment variables such as EDITOR will be stored, under `$XDG_CONFIG_HOME/environment.d` (needs to be a file name without extension)."; - default = "99-user-env"; - example = "99-user-env"; - }; }; config.assertions = mkIf (!config.local.profiles.server.enable) [ @@ -41,8 +34,5 @@ in { { assertion = options.local.homeVars.signingKey.isDefined; } - { - assertion = options.local.homeVars.userEnvFile.isDefined; - } ]; } diff --git a/modules/programs/editors/default.nix b/modules/programs/editors/default.nix index 7df7226..05a3735 100644 --- a/modules/programs/editors/default.nix +++ b/modules/programs/editors/default.nix @@ -5,7 +5,6 @@ }: let inherit (lib) mkIf; inherit (config.local.systemVars) username; - inherit (config.local.homeVars) userEnvFile; in { imports = [ ./neovim.nix @@ -20,10 +19,8 @@ in { unset -v EDITOR ''; hjem.users.${username} = { - files = { - ".config/environment.d/${userEnvFile}.conf".text = '' - EDITOR="nvim" - ''; + environment.variables = { + EDITOR = "nvim"; }; }; }; diff --git a/modules/programs/hypr/land/default.nix b/modules/programs/hypr/land/default.nix index 98b999a..153bcc7 100644 --- a/modules/programs/hypr/land/default.nix +++ b/modules/programs/hypr/land/default.nix @@ -7,7 +7,7 @@ ... }: let inherit (builtins) toString; - inherit (lib) mkIf optionalAttrs optionalString; + inherit (lib) mkIf mkMerge optionalAttrs; inherit (lib'.generators) toHyprConf; inherit (config.local.systemVars) username; @@ -146,7 +146,6 @@ in { force_default_wallpaper = 0; disable_hyprland_logo = true; middle_click_paste = false; - vrr = 1; }; } // optionalAttrs styleCfg.enable { @@ -161,24 +160,24 @@ in { } // import ./binds.nix lib; }; - ".config/environment.d/${config.local.homeVars.userEnvFile}.conf".text = - '' - GDK_SCALE="1" - '' - + optionalString styleCfg.enable '' - - HYPRCURSOR_THEME="${styleCfg.cursorTheme.name}" - HYPRCURSOR_SIZE="${toString styleCfg.cursorTheme.size}" - XCURSOR_SIZE="${toString styleCfg.cursorTheme.size}" - - '' - + optionalString config.local.modules.nvidia.enable '' - LIBVA_DRIVER_NAME="nvidia" - __GLX_VENDOR_LIBRARY_NAME="nvidia" - XDG_SESSION_TYPE="wayland" - GBM_BACKEND="nvidia-drm" - ''; }; + + environment.variables = mkMerge [ + { + GDK_SCALE = 1; + } + (mkIf styleCfg.enable { + HYPRCURSOR_THEME = "${styleCfg.cursorTheme.name}"; + HYPRCURSOR_SIZE = "${toString styleCfg.cursorTheme.size}"; + XCURSOR_SIZE = "${toString styleCfg.cursorTheme.size}"; + }) + (mkIf config.local.modules.nvidia.enable { + LIBVA_DRIVER_NAME = "nvidia"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + XDG_SESSION_TYPE = "wayland"; + GBM_BACKEND = "nvidia-drm"; + }) + ]; }; }; } diff --git a/modules/programs/terminal/programs/bat.nix b/modules/programs/terminal/programs/bat.nix index 8096a51..b331e94 100644 --- a/modules/programs/terminal/programs/bat.nix +++ b/modules/programs/terminal/programs/bat.nix @@ -5,7 +5,6 @@ ... }: let inherit (config.local.systemVars) username; - inherit (config.local.homeVars) userEnvFile; toConf = attrs: builtins.concatStringsSep "\n" (lib.mapAttrsToList (option: value: "--${option}=\"${value}\"") attrs); @@ -20,11 +19,10 @@ in { ".config/bat/config".text = toConf { theme = "base16"; }; - - ".config/environment.d/${userEnvFile}.conf".text = '' - MANPAGER = "sh -c 'col -bx | bat --language man' " - MANROFFOPT = "-c" - ''; + }; + environment.variables = { + MANPAGER = "sh -c 'col -bx | bat --language man'"; + MANROFFOPT = "-c"; }; }; };