mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 06:41:03 +02:00
chore(nix): simplify packaging and outputs
This commit is contained in:
parent
098df1ee26
commit
3b80b43582
7 changed files with 187 additions and 311 deletions
124
nix/package.nix
124
nix/package.nix
|
@ -23,16 +23,44 @@
|
|||
installShellFiles,
|
||||
adwaita-icon-theme,
|
||||
hicolor-icon-theme,
|
||||
rustPlatform,
|
||||
lib,
|
||||
version ? "git",
|
||||
features ? [],
|
||||
builderName ? "nix",
|
||||
builder ? {},
|
||||
naersk,
|
||||
}: let
|
||||
hasFeature = f: features == [] || builtins.elem f features;
|
||||
flags = let
|
||||
noDefault =
|
||||
if features == []
|
||||
then ""
|
||||
else "--no-default-features";
|
||||
|
||||
basePkg = rec {
|
||||
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;
|
||||
|
||||
pname = "ironbar";
|
||||
|
@ -48,15 +76,18 @@
|
|||
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
|
||||
]);
|
||||
};
|
||||
in
|
||||
fs.toSource {
|
||||
inherit root;
|
||||
# NOTE: can possibly filter out more
|
||||
fileset = fs.difference root (
|
||||
fs.unions [
|
||||
nixRelated
|
||||
cicdRelated
|
||||
ideRelated
|
||||
]
|
||||
);
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
|
@ -82,27 +113,14 @@
|
|||
++ lib.optionals (hasFeature "tray") [libdbusmenu-gtk3]
|
||||
++ lib.optionals (hasFeature "volume") [libpulseaudio]
|
||||
++ lib.optionals (hasFeature "cairo") [luajit]
|
||||
++ lib.optionals (hasFeature "keyboard") [libinput libevdev];
|
||||
++ lib.optionals (hasFeature "keyboard") [
|
||||
libinput
|
||||
libevdev
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [gtk3];
|
||||
|
||||
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"
|
||||
'';
|
||||
cargoBuildOptions = old: old ++ flags;
|
||||
|
||||
preFixup = ''
|
||||
gappsWrapperArgs+=(
|
||||
|
@ -119,48 +137,16 @@
|
|||
|
||||
passthru = {
|
||||
updateScript = gnome.updateScript {
|
||||
packageName = pname;
|
||||
attrPath = "gnome.${pname}";
|
||||
packageName = "ironbar";
|
||||
attrPath = "gnome.ironbar";
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
homepage = "https://github.com/JakeStanger/ironbar";
|
||||
description = "Customisable gtk-layer-shell wlroots/sway bar written in rust.";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.linux;
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "ironbar";
|
||||
};
|
||||
};
|
||||
|
||||
flags = let
|
||||
noDefault =
|
||||
if features == []
|
||||
then ""
|
||||
else "--no-default-features";
|
||||
|
||||
featuresStr =
|
||||
if features == []
|
||||
then ""
|
||||
else ''-F "${builtins.concatStringsSep "," features}"'';
|
||||
in [noDefault featuresStr];
|
||||
in
|
||||
if builderName == "naersk"
|
||||
then builder.buildPackage (basePkg // {cargoBuildOptions = old: old ++ flags;})
|
||||
else if builderName == "crane"
|
||||
then
|
||||
builder.buildPackage (basePkg
|
||||
// {
|
||||
cargoExtraArgs = builtins.concatStringsSep " " flags;
|
||||
doCheck = false;
|
||||
})
|
||||
else
|
||||
rustPlatform.buildRustPackage (basePkg
|
||||
// {
|
||||
buildNoDefaultFeatures = features != [];
|
||||
|
||||
buildFeatures = features;
|
||||
cargoDeps = rustPlatform.importCargoLock {lockFile = ../Cargo.lock;};
|
||||
cargoLock.lockFile = ../Cargo.lock;
|
||||
cargoLock.outputHashes."stray-0.1.3" = "sha256-7mvsWZFmPWti9AiX67h6ZlWiVVRZRWIxq3pVaviOUtc=";
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue