Skip to content

Commit

Permalink
build(nix): do not include unused inputs when using feature subset
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeStanger committed Apr 17, 2024
1 parent 314bfe7 commit ee1ade0
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
builderName ? "nix",
builder ? {},
}: let
hasFeature = f: features == [ ] || builtins.elem f features;

basePkg = rec {
inherit version;

Expand All @@ -51,30 +53,33 @@
gnome.adwaita-icon-theme
hicolor-icon-theme
gsettings-desktop-schemas
libxkbcommon
libpulseaudio
openssl
luajit
];
libxkbcommon ]
++ (if hasFeature "http" then [ openssl ] else [])
++ (if hasFeature "volume" then [ libpulseaudio ] else [])
++ (if hasFeature "cairo" then [ luajit ] else []);

propagatedBuildInputs = [ gtk3 ];

lgi = luajitPackages.lgi;

preFixup = ''
gappsWrapperArgs+=(
gappsWrapperArgs = ''
# Thumbnailers
--prefix XDG_DATA_DIRS : "${gdk-pixbuf}/share"
--prefix XDG_DATA_DIRS : "${librsvg}/share"
--prefix XDG_DATA_DIRS : "${webp-pixbuf-loader}/share"
--prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
# gtk-launch
--suffix PATH : "${lib.makeBinPath [ gtk3 ]}"
# cairo
--prefix XDG_DATA_DIRS : "${gdk-pixbuf}/share"
--prefix XDG_DATA_DIRS : "${librsvg}/share"
--prefix XDG_DATA_DIRS : "${webp-pixbuf-loader}/share"
--prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
# gtk-launch
--suffix PATH : "${lib.makeBinPath [ gtk3 ]}"
''
+ (if hasFeature "cairo" then ''
--prefix LUA_PATH : "./?.lua;${lgi}/share/lua/5.1/?.lua;${lgi}/share/lua/5.1/?/init.lua;${luajit}/share/lua/5.1/\?.lua;${luajit}/share/lua/5.1/?/init.lua"
--prefix LUA_CPATH : "./?.so;${lgi}/lib/lua/5.1/?.so;${luajit}/lib/lua/5.1/?.so;${luajit}/lib/lua/5.1/loadall.so"
'' else "");

preFixup = ''
gappsWrapperArgs+=(
${gappsWrapperArgs}
)
'';

Expand Down

0 comments on commit ee1ade0

Please sign in to comment.