From ebe68acdac531f625311389703e7716c9919dc80 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 1 Jan 2026 20:06:28 +0100 Subject: [PATCH 1/2] direnv: remove fish vendor_conf.d from output As this is causing more problems that it solves, and is also inconsistent with other shells, remove share/fish/vendor_conf.d, in order to allow fully declarative configuration of the shell integration in NixOS as well as other contexts like Home Manager. Signed-off-by: Sefa Eyeoglu --- pkgs/by-name/di/direnv/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/di/direnv/package.nix b/pkgs/by-name/di/direnv/package.nix index 255b2b1f3d77..cdecb982af97 100644 --- a/pkgs/by-name/di/direnv/package.nix +++ b/pkgs/by-name/di/direnv/package.nix @@ -48,6 +48,10 @@ buildGoModule rec { runHook postCheck ''; + postInstall = '' + rm -rf "$out/share/fish" + ''; + meta = { description = "Shell extension that manages your environment"; longDescription = '' From 26a640f83da2790452018b0de54d5ef01db1f663 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 1 Jan 2026 20:08:40 +0100 Subject: [PATCH 2/2] nixos/direnv: remove obsolete finalPackage direnv doesn't ship with a fish config anymore, which makes the finalPackage option obsolete. Signed-off-by: Sefa Eyeoglu --- nixos/modules/programs/direnv.nix | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/nixos/modules/programs/direnv.nix b/nixos/modules/programs/direnv.nix index 2be2059bcca3..fc8c52824090 100644 --- a/nixos/modules/programs/direnv.nix +++ b/nixos/modules/programs/direnv.nix @@ -16,6 +16,11 @@ let format = pkgs.formats.toml { }; in { + imports = [ + (lib.mkRemovedOptionModule [ "programs" "direnv" "finalPackage" ] + "programs.direnv.finalPackage has been removed now, as its value is identical to programs.direnv.package." + ) + ]; options.programs.direnv = { enable = lib.mkEnableOption '' @@ -26,12 +31,6 @@ in package = lib.mkPackageOption pkgs "direnv" { }; - finalPackage = lib.mkOption { - type = lib.types.package; - readOnly = true; - description = "The wrapped direnv package."; - }; - enableBashIntegration = enabledOption '' Bash integration ''; @@ -100,15 +99,6 @@ in config = lib.mkIf cfg.enable { programs = { direnv = { - finalPackage = pkgs.symlinkJoin { - inherit (cfg.package) name; - paths = [ cfg.package ]; - # direnv has a fish library which automatically sources direnv for some reason - postBuild = '' - rm -rf "$out/share/fish" - ''; - meta.mainProgram = "direnv"; - }; settings = lib.mkIf cfg.silent { global = { log_format = lib.mkDefault "-"; @@ -119,7 +109,7 @@ in zsh.interactiveShellInit = lib.mkIf cfg.enableZshIntegration '' if ${lib.boolToString cfg.loadInNixShell} || printenv PATH | grep -vqc '/nix/store'; then - eval "$(${lib.getExe cfg.finalPackage} hook zsh)" + eval "$(${lib.getExe cfg.package} hook zsh)" fi ''; @@ -127,13 +117,13 @@ in #$IN_NIX_SHELL for "nix-shell" bash.interactiveShellInit = lib.mkIf cfg.enableBashIntegration '' if ${lib.boolToString cfg.loadInNixShell} || [ -z "$IN_NIX_SHELL$NIX_GCROOT$(printenv PATH | grep '/nix/store')" ] ; then - eval "$(${lib.getExe cfg.finalPackage} hook bash)" + eval "$(${lib.getExe cfg.package} hook bash)" fi ''; fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration '' if ${lib.boolToString cfg.loadInNixShell}; or printenv PATH | grep -vqc '/nix/store'; - ${lib.getExe cfg.finalPackage} hook fish | source + ${lib.getExe cfg.package} hook fish | source end ''; @@ -153,7 +143,7 @@ in environment = { systemPackages = [ - cfg.finalPackage + cfg.package ]; variables.DIRENV_CONFIG = "/etc/direnv";