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} = {
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";
}

View file

@ -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;
};
};
}

View file

@ -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;
}
];
}

View file

@ -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";
};
};
};

View file

@ -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";
})
];
};
};
}

View file

@ -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";
};
};
};