modules: use hjem environment module

This commit is contained in:
Anthony Rodriguez 2025-02-02 19:28:10 +01:00
parent b8e696e17b
commit 4a38e90dfa
Signed by: nezia
SSH key fingerprint: SHA256:Ihfpl0rUpqDevYqnzSR34OYfVLbDNkBiUjs3CpX4ykA
6 changed files with 28 additions and 45 deletions

View file

@ -41,9 +41,5 @@ in {
}; };
}; };
hjem.users.${username} = { hjem.users.${username}.environment.variables.FLAKE = "${config.hjem.users.${username}.directory}/.dotfiles";
files.".config/environment.d/${config.local.homeVars.userEnvFile}.conf".text = ''
FLAKE="${config.hjem.users.${username}.directory}/.dotfiles"
'';
};
} }

View file

@ -3,6 +3,7 @@
config, config,
... ...
}: let }: let
inherit (lib.filesystem) listFilesRecursive;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
in { in {
config = lib.mkIf (!config.local.profiles.server.enable) { config = lib.mkIf (!config.local.profiles.server.enable) {
@ -24,7 +25,9 @@ in {
enable = true; enable = true;
directory = "/home/${username}"; directory = "/home/${username}";
user = "${username}"; user = "${username}";
environment.enable = true;
}; };
extraModules = listFilesRecursive ../../shared/modules/hjem;
}; };
}; };
} }

View file

@ -22,13 +22,6 @@ in {
type = str; type = str;
description = "your ssh public key (used for signing git commits)"; 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) [ config.assertions = mkIf (!config.local.profiles.server.enable) [
@ -41,8 +34,5 @@ in {
{ {
assertion = options.local.homeVars.signingKey.isDefined; assertion = options.local.homeVars.signingKey.isDefined;
} }
{
assertion = options.local.homeVars.userEnvFile.isDefined;
}
]; ];
} }

View file

@ -5,7 +5,6 @@
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
inherit (config.local.homeVars) userEnvFile;
in { in {
imports = [ imports = [
./neovim.nix ./neovim.nix
@ -20,10 +19,8 @@ in {
unset -v EDITOR unset -v EDITOR
''; '';
hjem.users.${username} = { hjem.users.${username} = {
files = { environment.variables = {
".config/environment.d/${userEnvFile}.conf".text = '' EDITOR = "nvim";
EDITOR="nvim"
'';
}; };
}; };
}; };

View file

@ -7,7 +7,7 @@
... ...
}: let }: let
inherit (builtins) toString; inherit (builtins) toString;
inherit (lib) mkIf optionalAttrs optionalString; inherit (lib) mkIf mkMerge optionalAttrs;
inherit (lib'.generators) toHyprConf; inherit (lib'.generators) toHyprConf;
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
@ -146,7 +146,6 @@ in {
force_default_wallpaper = 0; force_default_wallpaper = 0;
disable_hyprland_logo = true; disable_hyprland_logo = true;
middle_click_paste = false; middle_click_paste = false;
vrr = 1;
}; };
} }
// optionalAttrs styleCfg.enable { // optionalAttrs styleCfg.enable {
@ -161,24 +160,24 @@ in {
} }
// import ./binds.nix lib; // 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";
})
];
}; };
}; };
} }

View file

@ -5,7 +5,6 @@
... ...
}: let }: let
inherit (config.local.systemVars) username; inherit (config.local.systemVars) username;
inherit (config.local.homeVars) userEnvFile;
toConf = attrs: toConf = attrs:
builtins.concatStringsSep "\n" builtins.concatStringsSep "\n"
(lib.mapAttrsToList (option: value: "--${option}=\"${value}\"") attrs); (lib.mapAttrsToList (option: value: "--${option}=\"${value}\"") attrs);
@ -20,11 +19,10 @@ in {
".config/bat/config".text = toConf { ".config/bat/config".text = toConf {
theme = "base16"; theme = "base16";
}; };
};
".config/environment.d/${userEnvFile}.conf".text = '' environment.variables = {
MANPAGER = "sh -c 'col -bx | bat --language man' " MANPAGER = "sh -c 'col -bx | bat --language man'";
MANROFFOPT = "-c" MANROFFOPT = "-c";
'';
}; };
}; };
}; };