diff --git a/modules/core/nix.nix b/modules/core/nix.nix index 23d12bc..187d11c 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -1,10 +1,8 @@ { - lib, pkgs, config, ... }: let - inherit (lib) mkIf; inherit (config.local.systemVars) username; in { nix = { diff --git a/modules/core/users.nix b/modules/core/users.nix index ad85f1d..e067604 100644 --- a/modules/core/users.nix +++ b/modules/core/users.nix @@ -3,7 +3,6 @@ config, ... }: let - inherit (lib.filesystem) listFilesRecursive; inherit (config.local.systemVars) username; in { config = lib.mkIf (!config.local.profiles.server.enable) { @@ -25,9 +24,10 @@ in { enable = true; directory = "/home/${username}"; user = "${username}"; - environment.enable = true; + environment = { + forceOverride = true; + }; }; - extraModules = listFilesRecursive ../../shared/modules/hjem; }; }; } diff --git a/modules/services/greetd.nix b/modules/services/greetd.nix index 81dc99d..205365c 100644 --- a/modules/services/greetd.nix +++ b/modules/services/greetd.nix @@ -3,37 +3,51 @@ inputs, pkgs, config, + lib', ... }: # thanks https://git.jacekpoz.pl/poz/niksos/src/commit/f8d5e7ccd9c769f7c0b564f10dff419285e75248/modules/services/greetd.nix let - inherit (lib) getExe getExe'; + inherit (lib.attrsets) optionalAttrs; + inherit (lib.meta) getExe getExe'; + inherit (inputs.hyprland.packages.${pkgs.stdenv.system}) hyprland; + inherit (lib'.generators) toHyprConf; + + styleCfg = config.local.style; hyprctl = getExe' hyprland "hyprctl"; Hyprland = getExe' hyprland "Hyprland"; greeter = getExe pkgs.greetd.gtkgreet; - hyprlandConfig = - pkgs.writeText "greetd-hyprland-config" - '' - misc { - disable_hyprland_logo=true - force_default_wallpaper=false - focus_on_activate=true + hyprlandConfig = pkgs.writeText "greetd-hyprland-config" (toHyprConf { + attrs = + { + misc = { + disable_hyprland_logo = true; + force_default_wallpaper = false; + focus_on_activate = true; + }; + + animations = { + enabled = false; + first_launch_animation = false; + }; + workspace = "1,default:true,gapsout:0,gapsin:0,border:false,decorate:false"; + + exec-once = [ + "[workspace 1;fullscreen;noanim] ${greeter} -l; ${hyprctl} dispatch exit" + "${hyprctl} dispatch focuswindow ${greeter}" + ]; } - - animations { - enabled=false - first_launch_animation=false - } - - workspace=1,default:true,gapsout:0,gapsin:0,border:false,decorate:false - - exec-once=[workspace 1;fullscreen;noanim] ${greeter} -l; ${hyprctl} dispatch exit - exec-once=${hyprctl} dispatch focuswindow ${greeter} - ''; + // optionalAttrs styleCfg.enable { + env = { + HYPRCURSOR_THEME = styleCfg.cursorTheme.name; + HYPRCURSOR_SIZE = styleCfg.cursorTheme.size; + }; + }; + }); in { # TODO: perhaps turn this into a more generic module if we wanna use other wayland compositors config = lib.mkIf config.local.modules.hyprland.enable { diff --git a/shared/modules/hjem/environment.nix b/shared/modules/hjem/environment.nix deleted file mode 100644 index e3fe282..0000000 --- a/shared/modules/hjem/environment.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - config, - lib, - ... -}: let - inherit (lib) concatStringsSep mapAttrsToList; - inherit (lib.modules) mkIf; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) attrsOf listOf oneOf int path str; - - envFile = "99-user-env.conf"; - cfg = config.environment; - - toString = env: - if builtins.isList env - then concatStringsSep ":" env - else builtins.toString env; - - toConf = attrs: - concatStringsSep "\n" - (mapAttrsToList (name: value: "${name}=\"${toString value}\"") attrs); -in { - options.environment = { - enable = mkEnableOption "environment management"; - variables = mkOption { - default = {}; - example = { - EDITOR = "nvim"; - VISUAL = "nvim"; - }; - description = '' - A set of environment variables used in the user environment. - These variables will be set as systemd environment - variables, using `environment.d`. The value of each - variable can be either a string or a list of strings. The - latter is concatenated, interspersed with colon - characters. - ''; - type = attrsOf (oneOf [(listOf (oneOf [int str path])) int str path]); - }; - }; - - config = - mkIf cfg.enable - { - files.".config/environment.d/${envFile}".text = toConf cfg.variables; - - warnings = let - overlappingVars = builtins.filter (x: builtins.elem x (builtins.attrNames config.environment.variables)) (builtins.attrNames cfg.variables); - in - if overlappingVars != [] - then - map (name: '' - The environment variable '${name}' is defined in both - `hjem.users..environment.variables` and - `config.environment.variables`. This may lead to conflicts. - - If you want the one defined in hjem to take precedence, make sure you - unset it manually in `environment.extraInit` (`unset ${name}`). - '') - overlappingVars - else []; - }; -}