oizys/modules/nix-ld.nix

116 lines
2 KiB
Nix
Raw Permalink Normal View History

2024-03-19 07:24:30 -05:00
{
pkgs,
lib,
config,
2024-07-10 13:21:04 -05:00
enabled,
2024-03-19 07:24:30 -05:00
...
2024-05-06 14:32:00 -05:00
}:
let
2024-07-07 14:32:46 -05:00
inherit (lib)
mkEnableOption
mkIf
mkOption
literalExpression
types
2024-08-08 14:02:40 -05:00
optionals
2024-07-07 14:32:46 -05:00
;
2024-03-19 07:24:30 -05:00
cfg = config.oizys.nix-ld;
2024-07-07 14:32:46 -05:00
# https://github.com/NixOS/nixpkgs/blob/a4f437f0f5db62e6bcd7979c10eab177dd0fa188/nixos/modules/programs/nix-ld.nix#L44-L59
defaultLibraries = with pkgs; [
zlib
zstd
stdenv.cc.cc
curl
openssl
attr
libssh
bzip2
libxml2
acl
libsodium
util-linux
xz
systemd
];
# https://github.com/Mic92/dotfiles/blob/340152bdf4bd193269474426ca5d90c479aae0b7/nixos/modules/nix-ld.nix#L7-L58
overkillLibraries = with pkgs; [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
curl
dbus
expat
fontconfig
freetype
fuse3
gdk-pixbuf
glib
gtk3
icu
libGL
libappindicator-gtk3
libdrm
libglvnd
libnotify
libpulseaudio
libunwind
libusb1
libuuid
libxkbcommon
mesa
nspr
nss
openssl
pango
pipewire
stdenv.cc.cc
systemd
vulkan-loader
xorg.libX11
xorg.libXScrnSaver
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXtst
xorg.libxcb
xorg.libxkbfile
xorg.libxshmfence
zlib
];
2024-05-06 14:32:00 -05:00
in
{
2024-07-07 14:32:46 -05:00
options.oizys.nix-ld = {
enable = mkEnableOption "enable nix-ld support";
extra-libraries = mkOption {
type = types.listOf types.package;
description = "Libraries that automatically become available to all programs.";
default = [ ];
defaultText = literalExpression "baseLibraries derived from systemd and nix dependencies.";
};
overkill.enable = mkEnableOption "enable overkill list of libraries";
2024-01-23 11:51:13 -06:00
2024-03-19 07:24:30 -05:00
};
2024-07-07 14:32:46 -05:00
config =
2024-07-10 13:21:04 -05:00
let
2024-08-08 14:02:40 -05:00
libs = defaultLibraries ++ cfg.extra-libraries ++ (optionals cfg.overkill.enable overkillLibraries);
2024-07-10 13:21:04 -05:00
in
mkIf cfg.enable {
programs.nix-ld = enabled // {
package = pkgs.nix-ld-rs;
libraries = libs;
2024-07-07 14:32:46 -05:00
};
2024-07-10 13:21:04 -05:00
};
2024-01-23 11:51:13 -06:00
}