From 33965e2b286c16d590eba1612f337d95cde89395 Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Thu, 29 Feb 2024 21:24:22 +0000 Subject: [PATCH] Add mechanism to extend the PATH var on the derivation --- nix/fg42.nix | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/nix/fg42.nix b/nix/fg42.nix index ccb4147..8051cf4 100644 --- a/nix/fg42.nix +++ b/nix/fg42.nix @@ -40,6 +40,8 @@ gcc, ltex-ls, bash, + + supportPython ? true, }: with builtins; let @@ -54,8 +56,26 @@ let maintainers = import ./maintainers.nix; + runtimeBins = [ + ripgrep + git + ltex-ls + ] ++ (lib.optional supportPython [ + python311 + # Python deps + python311 + pyright + + python3Packages.black + python3Packages.pylint + python3Packages.flake8 + ]); + + paths = map (x: "${x}/bin/") (lib.lists.flatten runtimeBins); + pathsStr = lib.strings.concatStrings (lib.strings.intersperse ":" paths); + in stdenv.mkDerivation (final: rec{ - pname = "fg42$"; + pname = "fg42"; version = "4.0.0"; src = srcDir; @@ -80,6 +100,7 @@ in stdenv.mkDerivation (final: rec{ export FG42_HOME=${placeholder "out"}/share/fg42/ export FG42_EMACSD=~/.fg42/v4/emacs.d export FG42_USE_NIX=true; + export PATH=${pathsStr}:$PATH LIBRARY_PATH="\$(${stdenv.cc}/bin/cc -print-file-name=libgccjit.so):\$LIBRARY_PATH" \ FG42_WM=fales ${emacsBundle}/bin/emacs \ @@ -96,6 +117,7 @@ in stdenv.mkDerivation (final: rec{ export FG42_HOME=${placeholder "out"}/share/fg42/ export FG42_EMACSD=~/.fg42/v4/emacs.d export FG42_USE_NIX=true; + export PATH=${pathsStr}:$PATH # Disable access control for the current user. xhost +SI:localuser:$USER @@ -127,15 +149,7 @@ in stdenv.mkDerivation (final: rec{ ${vazir-fonts} ${fira-code} ${nerdfonts} - ${ripgrep} - ${git} - ${ltex-ls} - # Python deps - ${python311}/bin/python - ${pyright} - ${python3Packages.black} - ${python3Packages.pylint} - ${python3Packages.flake8} + ${lib.strings.concatLines paths} EOF runHook postBuild