diff --git a/modules/base.nix b/modules/base.nix index b79df8f..5173450 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -44,7 +44,7 @@ with lib; { elss = { locale.enable = mkDefault true; - zsh.enable = mkdDefault true; + zsh.enable = mkDefault true; }; boot = { diff --git a/modules/users.nix b/modules/users.nix index 3aa1ee5..b6de97e 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -37,8 +37,7 @@ with lib; { description = "Email address of the user"; }; git = mkOption { - type = types.attrsOf - (types.submodule { + type = types.submodule { options = { key = mkOption { type = types.str; @@ -57,7 +56,7 @@ with lib; { description = "Whether to force signing commits or not"; }; }; - }); + }; }; }; }); @@ -163,11 +162,20 @@ with lib; { (mapUsers mkUser) ]; }; - home-manager.users = mapAllUsersAndRoot (login: + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + users = mkMerge [ - { config.home.stateVersion = mkDefault "21.11"; } - (if homeConfigurations ? "${login}" then homeConfigurations."${login}" else { }) - ] - ); + (mapAllUsers mkX11User) + (mapAllUsers mkGitUser) + (mapAllUsersAndRoot (login: + mkMerge [ + { config.home.stateVersion = mkDefault "21.11"; } + (if homeConfigurations ? "${login}" then homeConfigurations."${login}" else { }) + ])) + ]; + }; + }; } diff --git a/modules/zsh.nix b/modules/zsh.nix index 66ed343..8405a29 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -1,34 +1,42 @@ -{ config, pkgs, lib, ...}: +{ config, pkgs, lib, ... }: with lib; { options.elss.zsh.enable = mkEnableOption "Setup systemwide zsh"; - config = { - environment = { - shells = [ pkgs.zsh ]; - pathsToLink = [ "/share/zsh/" ]; - sessionVariables = rec { - XDG_CACHE_HOME = "\${HOME}/.cache"; - XDG_CONFIG_HOME = "\${HOME}/.config"; - XDG_BIN_HOME = "\${HOME}/.local/bin"; - XDG_DATA_HOME = "\${HOME}/.local/share"; + config = + let + inherit (elss.withConfig config) mapAllUsers; + in + mkIf config.elss.zsh.enable { + environment = { + shells = [ pkgs.zsh ]; + pathsToLink = [ "/share/zsh/" ]; + sessionVariables = rec { + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_BIN_HOME = "\${HOME}/.local/bin"; + XDG_DATA_HOME = "\${HOME}/.local/share"; - PATH = [ - "\${XDG_BIN_HOME}" - ]; - }; - }; - programs = { - zsh = { - enable = true; - enableCompletion = true; - enableGlobalCompInit = true; - autosuggestions.enable = true; - syntaxHighlighting = { - enable = true; - highlighters = [ "main" "brackets" "root" "line" ]; - #styles = { cursor = "standout,underline"; }; + PATH = [ + "\${XDG_BIN_HOME}" + ]; }; - setOptions = [ "auto_pushd" "correct" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory" ]; }; + programs = { + zsh = { + enable = true; + enableCompletion = true; + enableGlobalCompInit = true; + autosuggestions.enable = true; + syntaxHighlighting = { + enable = true; + highlighters = [ "main" "brackets" "root" "line" ]; + #styles = { cursor = "standout,underline"; }; + }; + setOptions = [ "auto_pushd" "correct" "nocaseglob" "rcexpandparam" "numericglobsort" "nobeep" "appendhistory" ]; + }; + }; + + users.users = mapAllUsers (_: { shell = pkgs.zsh; } + + ); }; - }; }