diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b271ca0f3557..d8d6749f7965 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -114,6 +114,7 @@ ./programs/yabar.nix ./programs/zsh/oh-my-zsh.nix ./programs/zsh/zsh.nix + ./programs/zsh/zsh-autoenv.nix ./programs/zsh/zsh-syntax-highlighting.nix ./rename.nix ./security/acme.nix diff --git a/nixos/modules/programs/zsh/zsh-autoenv.nix b/nixos/modules/programs/zsh/zsh-autoenv.nix new file mode 100644 index 000000000000..630114bcda9f --- /dev/null +++ b/nixos/modules/programs/zsh/zsh-autoenv.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.zsh.zsh-autoenv; +in { + options = { + programs.zsh.zsh-autoenv = { + enable = mkEnableOption "zsh-autoenv"; + package = mkOption { + default = pkgs.zsh-autoenv; + defaultText = "pkgs.zsh-autoenv"; + description = '' + Package to install for `zsh-autoenv` usage. + ''; + + type = types.package; + }; + }; + }; + + config = mkIf cfg.enable { + programs.zsh.interactiveShellInit = '' + source ${cfg.package}/share/zsh-autoenv/autoenv.zsh + ''; + }; +} diff --git a/pkgs/tools/misc/zsh-autoenv/default.nix b/pkgs/tools/misc/zsh-autoenv/default.nix new file mode 100644 index 000000000000..492b72a176ed --- /dev/null +++ b/pkgs/tools/misc/zsh-autoenv/default.nix @@ -0,0 +1,40 @@ +{ stdenv, fetchFromGitHub, bash }: + +stdenv.mkDerivation rec { + name = "zsh-autoenv-${version}"; + version = "2017-12-16"; + + src = fetchFromGitHub { + owner = "Tarrasch"; + repo = "zsh-autoenv"; + rev = "2c8cfbcea8e7286649840d7ec98d7e9d5e1d45a0"; + sha256 = "004svkfzhc3ab6q2qvwzgj36wvicg5bs8d2gcibx6adq042di7zj"; + }; + + buildPhase = ":"; + + installPhase = '' + mkdir -p $out/{bin,share} + cp -R $src $out/share/zsh-autoenv + + cat <