I’m facing issues resulting from my env PATH being prioritised over the path from buildInputs
in an impure nix-shell
, which seems incorrect, since the intention of an impure shell is (always?) to be sure to use its explicit buildInputs
over possibly existing versions.
As a workaround I’m now explicitly setting the path of sub-envs like this:
{ pkgs ? import <nixpkgs> { config.documentation = { man.enable = false; doc.enable = false; info.enable = false; }; }
, unstable ? import <unstable> { config.documentation = { man.enable = false; doc.enable = false; info.enable = false; }; }
}:
let
pywpkgs = unstable.python310.withPackages (p: with p; [ pandoc-xnos openpyxl ]);
rbwpkgs = unstable.ruby_3_1.withPackages (p: with p; [ pandocomatic ]);
hswpkgs = unstable.haskellPackages.ghcWithPackages (h: with h; [
pandoc pandoc-crossref pandoc-include-code pandoc-plot
]);
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(texlive.combine { inherit (texlive)
scheme-small xcolor koma-script nth marvosym fontawesome multirow placeins enumitem tcolorbox
lualatex-math environ lastpage titlesec advdate
collection-langgerman collection-langenglish
;})
]
++ (with unstable; [
pandoc-drawio-filter pandoc-include pandoc-plantuml-filter pandoc-lua-filters
])
++ [ hswpkgs pywpkgs rbwpkgs ]; # proxy vars to get the out path for the complete env
# needed for LaTeX \today to function!
shellHook = ''
export SOURCE_DATE_EPOCH="$(date +%s)"
export FORCE_SOURCE_DATE=1
export PATH=${pywpkgs.out}/bin:${rbwpkgs.out}/bin:${hswpkgs.out}/bin''${PATH:+:''${PATH}}
'';
}
but that is a lot of boilerplate for obvious expected default functionality. Am I doing something wrong or is there a better way?