From c5999637e1d2f5463184b323d0687e84d8981d39 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 4 Oct 2025 11:06:08 -0500 Subject: add _zshenv options and remove .zprofile from home directory since it can be linked via setting ZDOTDIR= in zshenv instead --- home-manager/clone-repos.nix | 4 +--- nixos/default.nix | 1 + nixos/zshenv.nix | 24 ++++++++++++++++++++++++ users/timmy/default.nix | 10 +++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 nixos/zshenv.nix diff --git a/home-manager/clone-repos.nix b/home-manager/clone-repos.nix index aad6fab..0822d7b 100644 --- a/home-manager/clone-repos.nix +++ b/home-manager/clone-repos.nix @@ -14,6 +14,7 @@ in { config = lib.mkIf cfg.enable { # TODO look into xdg.configFile. + # home.file..source = config.lib.file.mkOutOfStoreSymlink "..."; home.activation = { cloneRepos = lib.hm.dag.entryAfter ["writeBoundary"] ('' export PATH="${pkgs.git}/bin:$PATH" @@ -29,8 +30,5 @@ in { (cloneMissing "${server}awesome" "${dotConfig}/awesome" "") ])); }; - home.file.".zprofile" = { - source = config.lib.file.mkOutOfStoreSymlink "${dotConfig}/zsh/zprofile"; - }; }; } diff --git a/nixos/default.nix b/nixos/default.nix index 5074c06..e934431 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -23,5 +23,6 @@ ./ssh.nix ./sudo.nix ./suspend.nix + ./zshenv.nix ]; } diff --git a/nixos/zshenv.nix b/nixos/zshenv.nix new file mode 100644 index 0000000..4c2fc7c --- /dev/null +++ b/nixos/zshenv.nix @@ -0,0 +1,24 @@ +{ lib, config, ... }: let + cfg = config.programs.zsh._zshenv; + generatedExports = lib.concatLines ( + lib.mapAttrsToList (var: value: ''export ${var}="${value}"'') cfg.exports + ); +in { + options.programs.zsh._zshenv = { + enable = lib.mkEnableOption "generate /etc/zshenv.local"; + exports = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = {}; + example = { + ZDOTDIR = "$HOME/.config/zsh"; + }; + }; + }; + + config = lib.mkIf cfg.enable { + environment.etc."zshenv.local".text = '' + # Exports + ${generatedExports} + ''; + }; +} diff --git a/users/timmy/default.nix b/users/timmy/default.nix index 659efde..cfe37fa 100644 --- a/users/timmy/default.nix +++ b/users/timmy/default.nix @@ -36,7 +36,15 @@ in { #config = lib.mkIf cfg.enable { config = { # Setup zsh - programs.zsh.enable = true; + programs.zsh = { + enable = true; + _zshenv = { + enable = true; + exports = { + ZDOTDIR = "$HOME/.config/zsh"; + }; + }; + }; #environment.systemPackages = [ pkgs.zsh-fast-syntax-highlighting ]; # TODO # Setup normal user -- cgit v1.2.3