1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 23:01:04 +02:00
ironbar/nix/package.nix

153 lines
3.6 KiB
Nix
Raw Normal View History

{
gtk3,
gdk-pixbuf,
librsvg,
webp-pixbuf-loader,
gobject-introspection,
glib-networking,
glib,
shared-mime-info,
gsettings-desktop-schemas,
wrapGAppsHook,
gtk-layer-shell,
gnome,
libxkbcommon,
libdbusmenu-gtk3,
libpulseaudio,
libinput,
libevdev,
openssl,
2024-03-30 23:43:30 +00:00
luajit,
luajitPackages,
pkg-config,
installShellFiles,
adwaita-icon-theme,
hicolor-icon-theme,
lib,
version ? "git",
features ? [],
naersk,
}: let
hasFeature = f: features == [] || builtins.elem f features;
flags = let
noDefault =
if features == []
then ""
else "--no-default-features";
featuresStr =
if features == []
then ""
else ''-F "${builtins.concatStringsSep "," features}"'';
in [
noDefault
featuresStr
];
lgi = luajitPackages.lgi;
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]}"
''
+ lib.optionalString (hasFeature "cairo") ''
--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"
'';
in
naersk.buildPackage {
inherit version;
2024-04-17 21:43:46 +01:00
pname = "ironbar";
2024-04-17 21:43:46 +01:00
src = let
fs = lib.fileset;
root = ../.;
nixRelated = fs.fileFilter (file: file.hasExt "nix" || file.name == "flake.lock") root;
cicdRelated = fs.unions [
(lib.path.append root "Dockerfile")
(lib.path.append root ".github")
];
ideRelated = fs.unions [
(lib.path.append root ".idea")
];
in
fs.toSource {
inherit root;
# NOTE: can possibly filter out more
fileset = fs.difference root (
fs.unions [
nixRelated
cicdRelated
ideRelated
]
);
};
2024-04-17 21:43:46 +01:00
nativeBuildInputs = [
pkg-config
wrapGAppsHook
gobject-introspection
installShellFiles
2024-04-17 21:43:46 +01:00
];
2024-03-30 23:43:30 +00:00
buildInputs =
[
gtk3
gdk-pixbuf
glib
gtk-layer-shell
glib-networking
shared-mime-info
adwaita-icon-theme
hicolor-icon-theme
gsettings-desktop-schemas
libxkbcommon
]
++ lib.optionals (hasFeature "http") [openssl]
++ lib.optionals (hasFeature "tray") [libdbusmenu-gtk3]
++ lib.optionals (hasFeature "volume") [libpulseaudio]
++ lib.optionals (hasFeature "cairo") [luajit]
++ lib.optionals (hasFeature "keyboard") [
libinput
libevdev
];
propagatedBuildInputs = [gtk3];
2024-03-30 23:43:30 +00:00
cargoBuildOptions = old: old ++ flags;
preFixup = ''
gappsWrapperArgs+=(
${gappsWrapperArgs}
)
'';
2024-04-17 21:43:46 +01:00
postInstall = ''
installShellCompletion --cmd ironbar \
--bash target/completions/ironbar.bash \
--fish target/completions/ironbar.fish \
--zsh target/completions/_ironbar
'';
passthru = {
updateScript = gnome.updateScript {
packageName = "ironbar";
attrPath = "gnome.ironbar";
};
};
2024-04-17 21:43:46 +01:00
meta = {
homepage = "https://github.com/JakeStanger/ironbar";
description = "Customisable gtk-layer-shell wlroots/sway bar written in rust.";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
mainProgram = "ironbar";
};
}