mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-18 07:13:44 +01:00
Merge pull request #140 from ryan4yin/nix-ld
feat: add nix-ld and LIBRARY_PATH for mason.nvim and other downloaded…
This commit is contained in:
@@ -30,6 +30,27 @@ in {
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
# These environment variables are needed to build and run binaries
|
||||
# with external package managers like mason.nvim.
|
||||
#
|
||||
# LD_LIBRARY_PATH is also needed to run the non-FHS binaries downloaded by mason.nvim.
|
||||
# it will be set by nix-ld, so we do not need to set it here again.
|
||||
extraWrapperArgs = with pkgs; [
|
||||
# LIBRARY_PATH is used by gcc before compilation to search directories
|
||||
# containing static and shared libraries that need to be linked to your program.
|
||||
"--suffix"
|
||||
"LIBRARY_PATH"
|
||||
":"
|
||||
"${lib.makeLibraryPath [stdenv.cc.cc zlib]}"
|
||||
|
||||
# PKG_CONFIG_PATH is used by pkg-config before compilation to search directories
|
||||
# containing .pc files that describe the libraries that need to be linked to your program.
|
||||
"--suffix"
|
||||
"PKG_CONFIG_PATH"
|
||||
":"
|
||||
"${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [stdenv.cc.cc zlib]}"
|
||||
];
|
||||
|
||||
# Currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||
#
|
||||
# NOTE: These plugins will not be used by astronvim by default!
|
||||
|
||||
@@ -16,4 +16,30 @@
|
||||
})
|
||||
)
|
||||
];
|
||||
|
||||
# https://github.com/Mic92/nix-ld
|
||||
#
|
||||
# nix-ld will install itself at `/lib64/ld-linux-x86-64.so.2` so that
|
||||
# it can be used as the dynamic linker for non-NixOS binaries.
|
||||
#
|
||||
# nix-ld works like a middleware between the actual link loader located at `/nix/store/.../ld-linux-x86-64.so.2`
|
||||
# and the non-NixOS binaries. It will:
|
||||
#
|
||||
# 1. read the `NIX_LD` environment variable and use it to find the actual link loader.
|
||||
# 2. read the `NIX_LD_LIBRARY_PATH` environment variable and use it to set the `LD_LIBRARY_PATH` environment variable
|
||||
# for the actual link loader.
|
||||
#
|
||||
# nix-ld's nixos module will set default values for `NIX_LD` and `NIX_LD_LIBRARY_PATH` environment variables, so
|
||||
# it can work out of the box:
|
||||
#
|
||||
# - https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/programs/nix-ld.nix#L37-L40
|
||||
#
|
||||
# You can overwrite `NIX_LD_LIBRARY_PATH` in the environment where you run the non-NixOS binaries to customize the
|
||||
# search path for shared libraries.
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user